comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL function randperm?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL function randperm? [message #36156 is a reply to message #36154] Wed, 20 August 2003 07:43 Go to previous messageGo to previous message
robert.dimeo is currently offline  robert.dimeo
Messages: 42
Registered: November 2001
Member
Oops...mistake in the syntax of my last posting...

Try this:

function randperm,n
return,sort(randomn(s,n))
end


Amara.Graps@ifsi.rm.cnr.it (Amara Graps) wrote in message news:<Amara.Graps-2008031259130001@amaramac.ifsi.rm.cnr.it>...
> 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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Two questions (about Mpeg and Networking)
Next Topic: bug in CONTOUR

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:12:24 PDT 2025

Total time taken to generate the page: 0.64218 seconds