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

Home » Public Forums » archive » Bizarre (?) behavior of randomu
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
Bizarre (?) behavior of randomu [message #57847] Wed, 02 January 2008 14:01
john.copley is currently offline  john.copley
Messages: 8
Registered: October 2001
Junior Member
The following procedure generates 4 lines of printout each time that
it's
called, and lines 2-4 in any given call show up as lines 1-3 in the
subsequent call. Can someone explain this behavior? It appears to be
independent of nn and of kmax; in general lines 2 to kmax in any given
call
show up as lines 1 to (kmax-1) in the subsequent call. Why would
anyone
want a random number generator that behaves like this? Even doing
a full reset (.fu) between calls does not prevent this bizarre
behavior.


pro rannummers
nn=100000
kmax=4
for k=0,kmax-1 do begin
rnum=randomu(seed,nn)
print,rnum[0:5],format='(6f10.5)'
endfor
end


IDL> .COMPILE "F:\Sears MS calcs\rannummers.pro"
Compiled module: RANNUMMERS.
IDL> rannummers
0.76336 0.74285 0.01224 0.70948 0.30904 0.63705
0.51222 0.94041 0.49834 0.79475 0.65187 0.73592
0.58348 0.85881 0.99142 0.41052 0.06792 0.09756
0.81062 0.44180 0.53801 0.15705 0.17151 0.21726
IDL> rannummers
0.51222 0.94041 0.49834 0.79475 0.65187 0.73592
0.58348 0.85881 0.99142 0.41052 0.06792 0.09756
0.81062 0.44180 0.53801 0.15705 0.17151 0.21726
0.02177 0.22671 0.44676 0.83688 0.27362 0.39455
IDL> rannummers
0.58348 0.85881 0.99142 0.41052 0.06792 0.09756
0.81062 0.44180 0.53801 0.15705 0.17151 0.21726
0.02177 0.22671 0.44676 0.83688 0.27362 0.39455
0.96702 0.92188 0.80097 0.76380 0.90646 0.35381
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: M.I'5.Persecuti on ` BB C h 2g2 onli ne
Next Topic: IDL 7.0 & ENVI

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

Current Time: Wed Oct 08 19:33:36 PDT 2025

Total time taken to generate the page: 0.00426 seconds