shuffle

Syntax

shuffle(X)

shuffle! is the in-place change version of shuffle.

Arguments

x is a vector/matrix.

Details

Return a new vector/matrix after taking a shuffle on the data.

Examples

x=(1..6).shuffle();
x;
// output
[1,6,3,5,4,2]

x.shuffle!();
// output
[5,4,1,3,2,6]


x=(1..6).reshape(3:2);
x;
#0 #1
1 4
2 5
3 6
x.shuffle();
#0 #1
5 3
2 1
4 6