vendredi 23 décembre 2016

Create a vector of random integers that only occur once with numpy / Python [duplicate]

This question already has an answer here:

I would like to get an array of integers in a certain range. But every number must occur once. Is there a possibility to do this as a simple one liner or simple command ?

Till now I only found

np.random.choice(10,10) 

or

np.random.randint(1,10,9)

But both of these functions do not give back a vector where every number only occurs once.

Hint: I know that Iam not allowed to ask for more numbers than there is compared to the range.




Aucun commentaire:

Enregistrer un commentaire