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

Home » Public Forums » archive » Randomu seed initialization
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Randomu seed initialization [message #68638] Wed, 11 November 2009 11:54
Conor is currently offline  Conor
Messages: 138
Registered: February 2007
Senior Member
So I'm really wondering if I've hit some sort of strange IDL bug
(although everytime I thought that so far I've been wrong). Still,
thought I'd post about it.

I've got a routine I'm running to do some simulations. It calls a
function (generate_population) which generates 1000 variables
populated along a certain distribution. In my routine I later
generate another set of 1000 variables to select some of the generated
population. In both of these cases IDL has to initialize the random
seed generator because (of course) the generate_population routine is
a separate function and so the main routine can't use the 'seed'
variable generated in generate_population.

However, I noticed that the cut being made was very strange and not at
all what it should have been. After some examination, I discovered
that the random variables being created by generate_population were
the exact same random variables being used to make the cuts - two
different calls to randomu() were returning exactly the same random
variables. Which means that they were using the same seed. Except I
wasn't giving either one the seed - it was being generated
automatically by IDL. Weird... I've tried reproducing this by making
simple routines that do the same sort of thing, but I don't have the
same problem. Which would make me think the problem is with something
I'm doing, but at the same time I just don't see any problems in my
code - the part dealing with the random number generators is simple
enough. I'm hoping someone here might have some insights into how IDL
initializes the random number generator that might help me figure out
what's going on. For now I've fixed the problem because I pass the
seed back and forth between the two routines (so it only gets
initialized once), but I'd really like to know what's happening. It's
hard for me to post the code because it's part of a routine that relys
on some large data files, but if people think it might help I might be
able to parse it down to something post-able.
[Message index]
 
Read Message
Previous Topic: Second edition of my book
Next Topic: idlastro mrdfits and strings

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

Current Time: Sat Oct 11 13:50:57 PDT 2025

Total time taken to generate the page: 1.12087 seconds