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

Home » Public Forums » archive » Re: Random selection
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: Random selection [message #51245 is a reply to message #51243] Sat, 11 November 2006 20:09 Go to previous messageGo to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <MPG.1fbff8149c4b0217989db8@news.frii.com>,
David Fanning <news@dfanning.com> wrote:

> Jean H. writes:
>
>> What do you mean? that there is another method or that it can not return
>> more than once the same index? ... I would be interested in knowning
>> another method!!!
>>
>> IDL> a = (Round(Randomu(seed, 100) * 1000))

The problem with this approach is that it is actually rather likely
that you will generate two (or more) numbers that round to the
same 3-digit integer.

Sorting floats, on the other hand, involves no loss of precision.

If you really want to avoid duplicates, generate double-precision
random numbers

r = RANDOMU(seed, 1000, /DOUBLE)

Cheers, Ken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: colorbar positioning in postscript
Next Topic: canonical correlations

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

Current Time: Sun Oct 12 17:06:36 PDT 2025

Total time taken to generate the page: 2.79674 seconds