random.shuffle

random.shuffle, function

def pure random.shuffle(e: ordinal): ordinal

Returns a random permutation of the input ordinal vector e.

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
User Contributed Notes
0 notes + add a note