I got the following piece of code:
import numpy as np
rand_draw1 = np.random.rand(5,4)
rand_draw2 = rand_draw1
rand_draw2[0:2,0:4] = np.random.rand(2,4)
My intention is to have the variables rand_draw1 and rand_draw2 to be identical except for the first two rows. However they turn out to be completely identical, even the first two lines.
Initially I thought this question answers my problem: Random Number Generation - Same Number returned which suggested that it must be due to the fact that these random draws are based on the machine clock and because the commands are executed in virtually the same instance, one draws the same numbers. But if that is the case, why do I get the same result running this in the terminal (i.e. typing the lines one-by-one)?
To summarize I have two questions: - How do I fix my code? - Is it indeed the machine-time 'problem' that causes this?
Thanks in advance!