MersenneTwisterRNG

75 views
Skip to first unread message

pau

unread,
Mar 24, 2012, 2:17:59 AM3/24/12
to watch...@googlegroups.com
Hello all.
My program hangs for several seconds after MersenneTwisterRNG() contructor:

engine = new GenerationalEvolutionEngine<>(factory, pipeline, new CachingFitnessEvaluator<>(evaluator), new TournamentSelection(new Probability(0.9d)), new MersenneTwisterRNG());

Why is that?

C:\>java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode, sharing)

Daniel Dyer

unread,
Mar 24, 2012, 10:58:31 AM3/24/12
to watch...@googlegroups.com
On Sat, 24 Mar 2012 06:17:59 -0000, pau <alexey....@gmail.com> wrote:

> Hello all.
> My program hangs for several seconds after MersenneTwisterRNG()
> contructor:
>
> engine = new GenerationalEvolutionEngine<>(factory, pipeline, new
> CachingFitnessEvaluator<>(evaluator), new
> TournamentSelection(newProbability(0.9d)),

> *new MersenneTwisterRNG()*);
>
> Why is that?

It's probably due to the seeding of the RNG. If you don't specify a seed
strategy it will use the default. On Windows, where there is no
/dev/random, it will download seed data from random.org. This may be
taking some time or it may be failing to connect and taking a while to
time out. You could try using the SecureRandomSeedGenerator instead
(http://maths.uncommons.org/api/org/uncommons/maths/random/SecureRandomSeedGenerator.html).

Dan.

--
Daniel Dyer

Reply all
Reply to author
Forward
0 new messages