Navigation :
random.shuffle
random.shuffle, function
def pure random.shuffle(e: ordinal): ordinal
Returns a random permutation of the input ordinal vector e.
e: the ordinal vector to permute.
Example
table T[dim] = extend.range(5)
T.ShuffledDim = random.shuffle(dim)
T.ShuffledN = T.N[T.ShuffledDim] default fail
show table "Shuffled order" with
T.N
T.ShuffledN
This outputs the following table:
| N |
ShuffledN |
| 1 |
2 |
| 2 |
1 |
| 3 |
3 |
| 4 |
4 |
| 5 |
5 |