[ 
https://issues.apache.org/jira/browse/MATH-1533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17110108#comment-17110108
 ] 

Gilles Sadowski commented on MATH-1533:
---------------------------------------

bq. I would expect the output to be deterministic in this case

I agree; and this is the case in the current development version, as shown in 
commit
cd003cb29fe11d0ab08500e067863b9e1a1bd3fe (in "master" branch).

You are most welcome to help reviewing/fixing the [pending 
issues|https://issues.apache.org/jira/issues/?jql=project%20%3D%20MATH%20AND%20fixVersion%20%3D%204.0%20AND%20statusCategory%20%3D%20new]
 so that we can make progress towards a very long-delayed official (beta) 
release of version 4.0.

> 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