I have a function
sample() that generate trajectories from random numbers. Before calling this function, I would do
My problem is that I call
rand() one more time than necessary in
sample() given the way my algorithm is implemented. This is part of my package PiecewiseDeterministicMarkovProcesses.jl.
Hence, if I call
rand() after my function
sample(), I missed a random number in the sequence of calls to
My question is then: how can I go back once in the random generator?
I found empirically that this works, but it is a bit hacky:
using Random Random.seed!(1) rand() #0.23603334566204692 # this following call is erroneous, I want to remove it from the stack of calls rand() #0.34651701419196046 Random.GLOBAL_RNG.idxF-=1 rand() # gives 0.34651701419196046 as expected
Thank you for your help,