dimanche 27 septembre 2015

How do I create a deterministic Random number generator with numpy seed?

As I understand the syntax is

In[88]: np.random.seed(seed=0)

In[89]: np.random.rand(5) < 0.8
Out[89]: array([ True,  True,  True,  True,  True], dtype=bool)
In[90]: np.random.rand(5) < 0.8
Out[90]: array([ True,  True, False, False,  True], dtype=bool)

However, when I run the rand(), I get different results. Is there something I am missing with the seed function?

Thanks.




Aucun commentaire:

Enregistrer un commentaire