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

Home » Public Forums » archive » Re: random numbers in version 4.0
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 numbers in version 4.0 [message #10393] Wed, 26 November 1997 00:00
Jack Saba is currently offline  Jack Saba
Messages: 30
Registered: January 1996
Member
RANDOMN uses the Box-Muller algorithm. This generates two random numbers
each time. In the FORTRAN implementation in Numerical Recipes, calls
#2,4,... to the subroutine return the "extra" value generated on the
previous call, and do NOT change the seed. I expect the same thing is
happening with the IDL implementation.

The only way around this appears to make sure you make an even number of
calls before beginning your next sequence.


Kirt Schaper wrote:
>
> Has anyone else encountered odd behavior with random numbers in
> IDL version 4.0? Specifically, if you repeatedly generate an odd
> number of random numbers with the same seed, you don't get the same
> numbers (strictly speaking, you do get the same numbers, but shifted
> one position). For example:
>
> % idl
> IDL. Version 4.0.1 (sunos sparc).
> Copyright 1989-1995, Research Systems, Inc.
> All rights reserved. Unauthorized reproduction prohibited.
> Installation number: XXXXXXX.
> Licensed for use by: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Initial setup: quiet=1, order=0
> IDL> seed = 10.
> IDL> s = seed & print,randomn(s,3)
> 2.10917 1.36675 -1.02318
> IDL> s = seed & print,randomn(s,3)
> -0.568035 2.10917 1.36675
> IDL> s = seed & print,randomn(s,3)
> 2.10917 1.36675 -1.02318
> IDL> s = seed & print,randomn(s,3)
> -0.568035 2.10917 1.36675
>
> This behavior has been repeated on HPUX, Digital UNIX and Solaris
> version of IDL. It seems to have gone away in version 5 but we
> are stuck with version 4.0 until the convolv 2X slowdown in
> version 5 is fixed.
>
> kt

--
Jack Saba <jack@magus.stx.com>
[Message index]
 
Read Message
Previous Topic: Re: ingesting GRIB files?
Next Topic: graphics accel card

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

Current Time: Wed Oct 08 15:36:31 PDT 2025

Total time taken to generate the page: 0.00399 seconds