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

Home » Public Forums » archive » Re: Random selection of pairs
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 of pairs [message #51244] Sun, 12 November 2006 04:55 Go to previous message
Julio[1] is currently offline  Julio[1]
Messages: 52
Registered: May 2005
Member
Thanks guys... it will help.

Cheers,
Julio

Michael Galloy escreveu:

> Kenneth P. Bowman wrote:
>> It will be much simpler, and probably much quicker, to read all
>> of the pairs and then pick 100 randomly, like this script named
>> select_random:
>>
>> x = findgen(2, 1000) ;create fake lon-lat data
>> r = RANDOMU(seed, 1000) ;generate random numbers
>> j = (SORT(r))[0:9] ;find indices of 10 smallest numbers
>
> Yes, I think this is the way to do it.
>
> It won't help here with only 1000 elements, but I have a routine to get
> the indices of the n smallest (or largest) values in an array. It uses
> HISTOGRAM and REVERSE_INDICES instead of the SORT in the line
>
> j = (SORT(r))[0:9]
>
> The article describing it is at:
>
> http://michaelgalloy.com/2006/06/02/finding-the-n-smallest-e lements-in-an-array.html
>
>
> Mike
> --
> www.michaelgalloy.com
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Keystrokes While IN a Graphics Window?
Next Topic: colorbar positioning in postscript

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

Current Time: Fri Oct 10 12:00:31 PDT 2025

Total time taken to generate the page: 0.00724 seconds