my dog learned polymorphism
The moose likes Java in General and the fly likes Collections.shuffle question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Collections.shuffle question" Watch "Collections.shuffle question" New topic
Author

Collections.shuffle question

Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
Does Collections.shuffle() use java.util.Random either as a default or in general? I know the algorithm is Fisher-Yates shuffle, but what the source of randomness is is important to me for the statistical analysis I am doing. Thanks.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3011
    
    9
Greg Werner wrote:Does Collections.shuffle() use java.util.Random either as a default or in general? I know the algorithm is Fisher-Yates shuffle, but what the source of randomness is is important to me for the statistical analysis I am doing. Thanks.


You can find the source code in the src.zip file in your JDK installation.
The answer is yes, but note that there is an overloaded version of shuffle that allows you to supply your own class as the source of randomness (as long as it extends Random).


Joanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collections.shuffle question
 
Similar Threads
Jumble ArrayList
Some direction required...
Random Numbers
Java Random
Shuffleing and array