[ 
https://issues.apache.org/jira/browse/MATH-1533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gilles Sadowski resolved MATH-1533.
-----------------------------------
    Resolution: Information Provided

Documented in commit 7f383414c2fff5caba046f4a4c5d9ff7e674b22f

> EnumeratedDistribution.sample() depends on ordering of input even if RNG is 
> given
> ---------------------------------------------------------------------------------
>
>                 Key: MATH-1533
>                 URL: https://issues.apache.org/jira/browse/MATH-1533
>             Project: Commons Math
>          Issue Type: Wish
>    Affects Versions: 3.6.1
>         Environment: Windows 10, Java 8
>            Reporter: WFR
>            Priority: Minor
>
> When constructing an EnumeratedDistribution with given RNG, the output of 
> samples depends on the ordering of the input:
> {code:java}
> EnumeratedDistribution<Integer> dis1 = new EnumeratedDistribution<>(
>             new Well19937c(42),
>             new ArrayList<>(Arrays.asList(new Pair<>(1, 0.3), new Pair<>(2, 
> 0.7)))
> );
> EnumeratedDistribution<Integer> dis2 = new EnumeratedDistribution<>(
>             new Well19937c(42),
>             new ArrayList<>(Arrays.asList(new Pair<>(2, 0.7), new Pair<>(1, 
> 0.3)))
> );
> System.out.println(Arrays.toString(dis1.sample(2))); // Yields [2, 1]
> System.out.println(Arrays.toString(dis2.sample(2))); // Yields [2, 2]
> {code}
> I would expect the output to be deterministic in this case, given that the 
> RNG is fixed and that from the definition of enumerated distributions there 
> is no reason for it to depend on the ordering of the input. Otherwise, a 
> remark in the constructor's documentation would be useful.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to