vendredi 6 mars 2020

Why does the length of the array given to np.random.shuffle() affect np.random.uniform()?

Simple example, changing the values inside the aa array does not change the result of np.random.uniform():

import numpy as np
np.random.seed(12345)
aa = np.array([3., 56., 7])
np.random.shuffle(aa)
print(np.random.uniform())

But changing its length does

import numpy as np
np.random.seed(12345)
aa = np.array([3., 56., 7, 0.])
np.random.shuffle(aa)
print(np.random.uniform())

I tried checking the source, but the way it's written is way above my Python skills.




Aucun commentaire:

Enregistrer un commentaire