Previously, I have used the function numpy.random.rand() like below.
import numpy as np
np.random.seed(0)
new_random_numbers = np.random.random(size=3)
And still I don't have any problems when I use it. But in numpy there are another way to generate random number like below.
RandomGenerator = np.random.RandomState(seed=0)
new_random_numbers = RandomGenerator.random(size=3)
using np.random.RandomState() looks shorter than before, however, I don't feel other advantages that I should use np.random.RandomState().
Are there anyone who know the advantage to use np.random.RandomState() than np.random.random()? I don't mind if it is very small advantage or for very exception case.
Thank for your help. Regards.
Aucun commentaire:
Enregistrer un commentaire