I've been doing MCMC chains in julia and need some help with random seeds.
Basically I'm generating data (using randn), then running a markov chain. I
like the fact that julia sets a new seed every time I launch the repl, however,
I don't know how to grab that initial seed for the same re-starting later, or
how to generate a new seed mid-algorithm it if I want a new start.
I want the initial seed so I can re-simulate the same data after some MCMC
tweaks, say. In addition, I sometimes want to re-simulate the same data, but
then start the markov chain with a different seed (in cases where I want to run
parallel markov chains on the same data). I've tried to work with RNG but I
can't seem to find where it lives. I've tried snooping around the source code,
and did find base/random.jl, but I couldn't seem to access the RNG variable
which is exported from there. Anyway, here is the hack I've been using ...
seed = rand(1:1000000) # set the seed for generating data
srand(seed)
data = generate_data()
seedloop = int(1e8*(abs(time()-round(time())))) # set the seed for the markov
chain
srand(seed)
for steps = 1:10000
...code for markov chain....
end
Any help on doing this the right way?