commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject Re: [math] inconsistent use of random generators
Date Wed, 17 Nov 2010 08:19:07 GMT
Le 17/11/2010 02:14, Ted Dunning a écrit :
> It is also desirable to have a way to inject a test generator so that test
> cases can be made deterministic.

Yes, this is what is done in the classes that already have a constructor
argument, the tests do use it and use hard coded funny constants to seed
the generator.

> In Mahout, we did this by having a static method in a utility class for
> getting a standard generator for either testing or normal operation.  This
> has turned out very well.

It's a very good idea for production code, but I am not sure I
understand it's use for test code. Doesn't that induce problems when new
tests are included which change the running order of the tests or when
only one test is run ? In these cases the current state for the
generator will not be the same in each situation. Do tests reseed the
generator when they start ?


> +1 on using a better default generator.
> On Tue, Nov 16, 2010 at 1:16 PM, Luc Maisonobe <>wrote:
>> I would also like to have one generator for each instance
>> set up at construction time. I also think JDKRandomGenerator is probably
>> not a good default and one of the more modern generators we now have
>> could be used like Well19937c.

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

View raw message