From octave-sources-request at bevo dot che dot wisc dot edu Wed Mar 22 09:17:09 2000 Subject: simple function: randperm.m From: Stephen Eglen To: octave-sources at bevo dot che dot wisc dot edu Date: Wed, 22 Mar 2000 15:17:04 GMT Here's a simple function for permuting the integers 1 to N (given same name as corresponding function in matlab.) function y = randperm(n) ## Return a random permutation of the integers 1 to N. ## ## Example: ## randperm(5)' ## ans = 1 4 5 3 2 [ordered_nums, y] = sort(rand(n,1)); endfunction ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------