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

Home » Public Forums » archive » Re: Random Number Replication
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 Replication [message #16584] Fri, 06 August 1999 00:00
korpela is currently offline  korpela
Messages: 59
Registered: September 1993
Member
In article <37aaad97.5297206@trog.dera.gov.uk>,
David Sheerin <dsheerin@dera.gov.uk> wrote:
> FOR k = 1, 4 DO BEGIN
> p = RANDOMU (S)
> PRINT, p
> ENDFOR

You do know that a better way to do this would be....

p=randomu(s,4)
print,p

Eric
--
Eric Korpela | An object at rest can never be
korpela@ssl.berkeley.edu | stopped.
<a href="http://sag-www.ssl.berkeley.edu/~korpela">Click for home page.</a>
Re: Random Number Replication [message #16585 is a reply to message #16584] Fri, 06 August 1999 00:00 Go to previous message
Andy Loughe is currently offline  Andy Loughe
Messages: 174
Registered: November 1995
Senior Member
David Sheerin wrote:
>
> Hi
> I have tried to use the following code to generate a sequence of
> random numbers:
>
> FOR k = 1, 4 DO BEGIN
> p = RANDOMU (S)
> PRINT, p
> ENDFOR
>
> Why, when I repeat the operation, does the code (nearly) give me the
> same list of random numbers shifted by 1? I thought that each time
> RANDOMU was called it took a new value for the SEED due to S being
> undefined. How do I 'undefine' S after it has been called?
>
> Cheers
>
> David Sheerin



I am unable to replicate your results.

I always set the intial seed in this manner...

S = long( ( systime(1) - long(systime(1)) ) * 1.e8 )

p = randomu(S)



--
Andrew F. Loughe | email: afl@cdc.noaa.gov
NOAA-CIRES CDC Mail Code: R/E/CD1 | www :
http://www.cdc.noaa.gov/~afl
325 Broadway | voice: (303)497-6211
Boulder, CO 80303-3328 | fax : (303)497-7013
------------------------------------------------------------ ---------------
"I do not feel obliged to believe that the same God who has endowed us
with
sense, reason, and intellect has intended us to forego their use."
-Galileo
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Modal Windows and Object Graphics
Next Topic: Re: tracking error while running as binaries

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

Current Time: Wed Oct 08 17:11:49 PDT 2025

Total time taken to generate the page: 0.00454 seconds