dimanche 6 décembre 2020

Shuffel array such that the expected index of an element will be its original index

consider an array:

a=[0,1,2,3,4,5,6,...99]

I'd like to shuffel it so that the expected element to end up in the 0th position is 0, in the 1st position is 1, 2nd position is 2 etc.




Aucun commentaire:

Enregistrer un commentaire