• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Collections.shuffle question

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic