Is this proper use of numpy seeding for parallel code?
问题 I am running n instances of the same code in parallel and want each instance to use independent random numbers. For this purpose, before I start the parallel computations I create a list of random states, like this: import numpy.random as rand rand_states = [(rand.seed(rand.randint(2**32-1)),rand.get_state())[1] for j in range(n)] I then pass one element of rand_states to each parallel process, in which I basically do rand.set_state(rand_state) data = rand.rand(10,10) To make things