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

Home » Public Forums » archive » Re: Randomize array order
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: Randomize array order [message #55023 is a reply to message #55022] Thu, 26 July 2007 05:50 Go to previous messageGo to previous message
mattf is currently offline  mattf
Messages: 13
Registered: January 2007
Junior Member
On Jul 25, 3:17 pm, Conor <cmanc...@gmail.com> wrote:
> Hi everyone!
>
> Anyone know an efficient way to randomize an array (I have a
> sorted array that I want unsorted). Initially, I tried something like
> this:
>
> array = findgen(1000000)
> unsort = array[sort(randomu(seed,1000000))]
>
> It works, but sorting on a million elements is rather slow. Anyone
> know a faster way?

I think this is one of those vectorization cases where you have a
trade-off between processor time and memory-- the one 'obvious' faster
way that occurs to me is to pre-compute a sequence of a few billion
random integers-- and then just select sub-sequences as needed. It's
possible that there's some intermediate strategy that's not quite so
extravagantly wasteful of memory.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
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: Routine for Converting DN to Radiance to Temperature
Next Topic: Re: Socket server in > IDL 6.3

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

Current Time: Wed Oct 08 19:33:12 PDT 2025

Total time taken to generate the page: 0.00374 seconds