| IDL function randperm? [message #36164] |
Wed, 20 August 2003 03:59 |
Amara.Graps
Messages: 11 Registered: November 1998
|
Junior Member |
|
|
Greetings!
I wonder if any of you have an IDL function that gives a
random permutation of an array index, or know of a
straightforward way to compute it?
In Matlab such a function is called "randperm(n)"
where n is the length of the array.
For example, if one gives the integer 8, then it returns
a length 8 integer array with values 0 to 7, randomly permutated.
It is not as simple as it sounds, since the indices are unique.
I tried variations of randomly SHIFT'g indices from INDGEN()
with a random number generator, and the values were not
'jumbled' satisfactorily.
Thanks in advance for any answer!
Amara
--
************************************************************ *******
Amara Graps, PhD |Istituto di Fisica dello Spazio Interplanetario
| INAF, Roma, Italia
| tel +39-06-4993-4384 fax +39-06-4993-4383
http://www.mpi-hd.mpg.de/dustgroup/~graps
************************************************************ ********
"We came whirling out Nothingness scattering stars like dust."- Rumi
|
|
|
|