I am trying to "skip forward" a few realizations by using the function Future.randjump(), but it doesn't seem to behave as I expect it to. The following code gives me the desired result, where jumping forward 1 steps gives the same result as if I had called randn(rng)
twice, i.e. the two println display the same number:
using Random, Future
rng = MersenneTwister(123);
new_rng = Future.randjump(rng, 1)
randn(rng)
randn(rng)
println(randn(rng))
println(randn(new_rng))
However, if I add one extra call to randn(rng) before the call to randjump(), the two printed numbers are completely different:
using Random, Future
rng = MersenneTwister(123);
randn(rng) # Added line
new_rng = Future.randjump(rng, 1)
randn(rng)
randn(rng)
println(randn(rng))
println(randn(new_rng))
I expected that the two calls to println()
would display the same thing even in the second case, how come they don't? Is there a way I can use randjump()
in the second case to get the same realizations as if I had called randn(rng)
several times? Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire