commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject Re: [lang] Support reseeding the RandomUtils random number generator
Date Wed, 07 May 2003 15:18:40 GMT


On Wed, 7 May 2003, Phil Steitz wrote:

> Henri Yandell wrote:
>
> > We would optionally add RandomUtils.nextInt(min, max) which would call on
> > through to RandomUtils.nextInt(JVM_RANDOM, min, max) as this would work as
> > the user would expect.
> >
> > So the static instance would not be reseedable, as with the JVM it would
> > effectively be immutable, but anyone who wants to use their own Random
> > instance can quite happily use the methods in RandomUtils in the
> > time-honoured XxxUtils.doThing(Xxx, others) way.
> >
> > How does that sound? It fixes the 'broken-ness' of RandomUtils' XxxUtils
> > contract [we need to document the XxxUtils contract somewhere] and gives
> > you a platform to start enhancing Random's methods in. You just don't get
> > the ability to change the JVM_RANDOM's seed and have to carry your own new
> > Random().
>
> Yes, this sounds like a good way to handle seeding which will be 100%
> backward compatable and will allow users to engage in just as much
> fiddling as they wish to.  They will essentially have 3 choices: 1)
> current semantics -- behavior like math.Random(); 2) use their own
> Random; 3) manipulate the "JVM" Random.
>
> Here, if I understand correctly, is the sequence of enhancements to get
> us there:
>
> 0. add the simple "completeness" extensions mentioned above (maybe not
> the "sampling objects", since this may be better off somewhere else)
> 1. add the RandomUtils.doThing(Random,args) methods
> 2. add JVMRandom, exposed as RandomUtils.RANDOM
> 3. modify RandomUtils.doThing(args) to mean
> RandomUtils.doThing(RandomUtils.RANDOM,args).
>
> Did I get this right?
>
>

Ignoring the rude fact that I just went and did a bit of it :) JVMRandom
is in, and RandomUtils is modified to fit the new concept. All you now
need to do is supply a patch with your doThing's in.

Sorry if that's more work for you, I'll happily take a private email with
your old methods in and just integrate them if you'd prefer. Also
apologies for the slowness in this email compared to the cvs commit, my
LAN is dropping half the packets it seems.

Hen


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message