• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to initialize multiple distributions using the same seed or same random stream?  RSS feed

 
Sm Arifin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a question regarding how to initialize multiple distributions using the same seed or same random stream in colt. Any help would be greatly appreciated!

I have a Java simulation in which I need to use Uniform, Exponential, Poisson, and Gamma distributions - and I need to initialize the random stream and/or each of these distributions with the same seed (so that I can exactly reproduce a trajectory given a fixed seed).

I am using Parallel Colt (which is a multithreaded version of Colt). Following the Parallel Colt Documentation https://sites.google.com/site/piotrwendykier/software/parallelcolt:

For Uniform, I could properly seed a DoubleUniform object (after importing from cern.jet.random.tdouble.DoubleUniform) as:

However, for Exponential, Poisson, and Gamma distributions (all in cern.jet.random.tdouble), I cannot do the same by passing the fixedSeed - because they expect a DoubleRandomEngine object to be passed:

Is there a way to initialize these (Exponential, Poisson, and Gamma) the same way as I did with Uniform? Or should I instantiate a parent/base class (if so, how?) in cern.jet.random.tdouble from which all these classes have been extended?

Notes:
Again, I'd like to have a single random stream (so that all my distributions could use random numbers from that stream) - this is very important for reproducibility.
An example simulation may need to sample these distributions millions of times (in total) - so performance/speed is always an issue.
 
Stephan van Hulst
Saloon Keeper
Posts: 7991
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of them have a constructor that takes a DoubleRandomEngine. You can construct each one with a new DoubleMersenneTwister that you initialized with the same seed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!