Well19937c started from the same seed yields different sequence
ibartha-vir opened this issue · 2 comments
ibartha-vir commented
spire version: 0.17.0-M1
scala version: 2.12.10
val time = System.nanoTime
println(spire.random.rng.Well19937c.fromTime(time).nextDouble)
println(spire.random.rng.Well19937c.fromTime(time).nextDouble)
println(spire.random.rng.Well19937c.fromTime(time).nextDouble)
println(spire.random.rng.Well19937c.fromTime(time).nextDouble)
println(spire.random.rng.Well19937c.fromTime(time).nextDouble)
The above prints 6 different numbers even though they are started from the same seed.
lourkeur commented
Reproduced. This looks like it's by design on all fromTime
constructors. If you need reproducible sequences, you can use fromSeed
and randomSeed
. See https://scastie.scala-lang.org/762xcRuhSX67GOuXK2KA1w
ibartha-vir commented
Thanks!