This question already has an answer here:
- Generate a random derangement of a list 6 answers
I know how to generate random sequence of list of numbers. Here is an example :
lst = np.arange(10) #lst always 0 .. n
np.shuffle(lst)
the question is how to shuffle the numbers so that the number ONE is NOT at position ONE, 2 is not at pos 2, and in general x is not at position x. For all 0 .. n
Aucun commentaire:
Enregistrer un commentaire