|
From: | Steve Railsback |
Subject: | Re: [Swarm-Support] Query regarding changing seed in a RNG |
Date: | Thu, 13 Sep 2007 11:54:52 -0700 |
User-agent: | Thunderbird 2.0.0.6 (Windows/20070728) |
Kavita Gangal wrote:
Hello, My problem is as follows:I need to generate varying series of random integers between 1 and 60 using swarm Random Number Generators.Currently I am using the following syntax: Globals.env.uniformIntRand.getIntegerWithMin$withMax (1,60);
I am not too familiar with this...maybe someone will correct me.I think this uniformIntRand distribution uses a built-in random number generator called Globals.env.randomGenerator. It is an instance of SimpleRandomGenerator, the MT19937.
According to the documentation set, SimpleRandomGenerator inherits methods from BasicRandomGenerator, which includes "setStateFromSeed". You should be able to set the seed using:
Globals.env.randomGenerator.setStateFromSeed (anInteger);Somewhere (in the old email archives?) you can find examples of using the current clock time etc. as the value of (anInteger).
Steve R.
[Prev in Thread] | Current Thread | [Next in Thread] |