mercredi 4 juillet 2018

Do consequtive RNG seed yield independent random numbers?

I have a script in which I use random simulations. This script runs on a cluster multiple times (about 100). Of course I want the results of each script to be independent from each other, however I also want that the results can be reproduced. Hence I would like to set the seed of the random number generator at the beginning of the script, however this seed of course has to be different in each run on the cluster.

I thought to do it like this:

import sys
import numpy as np
# sys.argv[1] is the number of the job on the cluster
np.random.seed(int(sys.argv[1]))

However this of course gives me consecutive seeds (1,2,3...). Are the random numbers (and in the end) the results of these consecutive seeds random and independent?




Aucun commentaire:

Enregistrer un commentaire