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

Home » Public Forums » archive » Random number generators in IDL
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 number generators in IDL [message #8122 is a reply to message #8055] Fri, 07 February 1997 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Michael Lefsky <mal3p@faraday.clas.Virginia.EDU> writes:

> As many of you pointed out, I ignored the need to check
> the seed given to the random number generator. I had
> always assumed that the time variable that is used as the
> default "seed" value changed relatively quickly- it
> doesn't- I run a routine that generates 1000 random numbers
> at once, and I can easily call it twenty times or more
> before the default seed changes.

To create 1000 random numbers at once, don't do it in a loop!
This is not Fortran code we are writing, folks! :-)

Do this:

thousandRandomNumbers = RANDOMU(seed, 1000)

If you want 1000 random numbers between 0 and 100, do this:

thousandRandomNumbers = RANDOMU(seed, 1000) * 100

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
-----------------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Filename variable from device?
Next Topic: Keeping Up with the News

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

Current Time: Fri Oct 10 13:46:39 PDT 2025

Total time taken to generate the page: 7.83793 seconds