Contents Previous Next Subchapters

Generating a Random Permutation
Syntax randperm(n)
See Also seed , snormal

Generates a random ordering of the integers between 1 and the real part of n, where n is an integer, real, complex scalar with real part equal to an integer value. The return value is an integer row vector of length equal to the real part of n.

If you enter
O-Matrix will reply
     [ 4 , 1 , 3 , 5 , 2 ]
Note that the return value depends on the current seeding of the O-Matrix random number generator. If you continue by enter
O-Matrix will reply
     [ 2 , 1 , 4 , 3 , 5 ]