mercredi 29 janvier 2020

Generate random numbers from a list of numbers

I have a list of numbers:

data = [15, 30, 45]

how to generate a list of N numbers taken randomly from this data list? To get result as:

new_data = [15,15, 30, 45, 15,45, 30, 15, 45, 30, 45, 45, 45, 15, ...]

np.random.randint(15, high=45, size=N) # does not help here

What numpy functions to use for this?




Aucun commentaire:

Enregistrer un commentaire