How do I force the random number generator (if possible) with a specific seed in scala breeze, so say the following scala code always generate the same sequence seq
?
import breeze.stats.distributions._
val g = new Gaussian(0, 1)
val seq = gau.sample(3)
I'm using scala to build a monte carlo simulator, and would like the simulation results to be repeatable (through parameterization of a specific random seed).
Create an implicit RandBasis and thread that through to wherever you create random generators. I should probably improve the API for this, but something like:
implicit val randBasis: RandBasis = new RandBasis(new ThreadLocalRandomGenerator(new MersenneTwister(seed)))