randperm
Random permutation of integers values.
📝Syntax
p = randperm(n, k)
📥Input Arguments
Parameter Description
n Number of integers in sample interval (positive integer).
k Number of integers to select (positive integer).
📤Output Arguments
Parameter Description
p a row vector.
📄Description

p = randperm(n) returns a row vector containing a random permutation of 1:n.

💡Examples
randperm(7)
🔗See Also
rand
🕔Version History
Version Description
1.0.0 initial version
1.15.0 add second input argument for number of elements to select
Edit this page on GitHub