commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <>
Subject [lang] Support reseeding the RandomUtils random number generator
Date Wed, 07 May 2003 05:26:51 GMT
I can see two ways to do this:

a) Leave the methods static,add a static field holding a 
java.math.Random, which can be reseeded. "Scope" of seeding becomes 

b) Add the Random as an instance variable and change the methods to be 
instance methods.

Pros of a): least change from current implementation, guarantees 
"expected" random sequence behavior whether or not user ever reseeds.
Cons of a): usual objections to statics

Pros of b): user has full control of his/her instance, no statics
Cons of b): if user creates a new instance each time, behavior will be 
similar to using new Random() each time, which does not generate a good 
  random sequence. To get a good sequence, user needs to create an 
instance and use that instance repeatedly.

I have a patch that does a).  Should I submit this or is b) a better 
approach -- or is there another approach that is better than either a) 
or b)?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message