mardi 18 avril 2023

Why does np.random.choice take so much longer than np.random.randint?

I've been reading that np.random.choice is faster than np.random.randint, however when comparing the speed difference between

import numpy as np

for i in range(100000):
    np.random.choice(100)

and

import numpy as np

for i in range(100000):
    np.random.randint(100)

np.random.randint is appreciably faster. What's the difference between these two?




Aucun commentaire:

Enregistrer un commentaire