| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
p = randperm(n)
p = randperm(n) returns a random permutation of the integers 1:n.
The randperm function calls rand and therefore changes the state of the default random number stream.
randperm(6) might be the vector
[3 2 6 4 1 5]
or it might be some other permutation of 1:6.
![]() | randn (RandStream) | randperm (RandStream) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |