commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject [math] inconsistent use of random generators
Date Tue, 16 Nov 2010 21:16:10 GMT
Hi all,

Some of our algorithms do use random number generation. I quickly
reviewed them and found different ways to use them.

Genetic algorithm use a single static RandomGenerator shared by all
instances. It default to JDKRandomGenerator and can be reset by calling

Multi-start optimizers use a separate RandomGenerator for each instance,
set by a constructor argument.

NaturalRanking use either a RandomDataImpl which is itself either based
on a RandomGenerator constructor argument or a JDKRandomGenerator by
default if the user did not provide a generator.

Kmeans++ use directly a java.util.Random instance provided as a
constructor argument (only this class can be used, none of our
generators can be used here).

What about changing this to be more consistent ? I would like to have
all our algorithms use the RandomGenerator interface, thus allowing the
user to put the generator more suited to their needs (it can be the JDK
one or a better one like Mersenne-Twister or one of the WELL
generators). 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