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

Home » Public Forums » archive » Re: Randomu() behavior - BAD!
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: Randomu() behavior - BAD! [message #68595] Fri, 13 November 2009 13:42 Go to previous message
Conor is currently offline  Conor
Messages: 138
Registered: February 2007
Senior Member
On Nov 13, 3:43 pm, David Fanning <n...@dfanning.com> wrote:
> Conor writes:
>> So I did a simple test and have a better idea of how the seed
>> initialization works with randomu(). In my mind, this is not good
>> news!
>
> I've written a new RandomNumberGenerator object this morning
> that may get around some of these problems. (And avoid
> common blocks, too!) You can find it here:
>
> http://www.dfanning.com/programs/randomnumbergenerator__defi ne.pro
>
> There are probably any number of way you could use
> this object, but here is one possibility. You could
> create a new system variable that would be able to give
> you random numbers on demand. The seed is always maintained
> properly, so that the random number sequence will not repeat
> in your lifetime. ;-)
>
> IDL> DefSysV, !RNG, Obj_New('RandomNumberGenerator')
> IDL> Print, !RNG -> GetRandomNumbers(3)
> 0.089239137 0.77428782 0.069180504
>
> You can set the initial seed, but if you don't, the number
> of seconds after 1 January 1970 is used. The random sequence
> will continue for as long as the object is alive in the IDL
> session.
>
> You could create this object and system variable, for example,
> in your IDL startup script, and then any program you wrote
> could access it.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Oooh, I like it!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Save a linkedlist?
Next Topic: Function as variable issue but in own file

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

Current Time: Wed Oct 08 11:42:18 PDT 2025

Total time taken to generate the page: 0.00446 seconds