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

Home » Public Forums » archive » Re: Random number generators in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Random number generators in IDL [message #8054] Wed, 05 February 1997 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Michael Lefsky <mal3p@faraday.clas.Virginia.EDU> writes:

> Is there any known problem with the number generators in idl?
> I am printing out sequences of 300 random numbers generated with
> RANDOMU and getting exactely the same sequence. ANy help would
> be appreciated.

Sounds like you are always starting with the same seed. The
IDL random number generators, like most (all?) random number
generators on computers, produces a pseudo-random sequence
of numbers. If you always start with the same seed, you will
always get the same pseudo-random sequence.

Widget programs sometimes run into random number problems
if the event handler depends on a random number sequence.
If you go into the event handler quickly, over and over, you can
appear to get the same number out of the generator. The trick
here is to store the seed in a common block (yuck!). Or, if you
hate common blocks as much as I do, store the seed in the
info structure. (This way you can have many independent
random number processes going all at once!)

Cheers!

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: TVIM and multiple plots.
Next Topic: Re: Multiple TVIM's to one scale.

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

Current Time: Wed Oct 08 20:06:11 PDT 2025

Total time taken to generate the page: 0.00687 seconds