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

Home » Public Forums » archive » Re: 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
Re: Randomu seed initialization [message #68637 is a reply to message #68615] Wed, 11 November 2009 12:22 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Nov 11, 5:54 pm, Conor <cmanc...@gmail.com> wrote:
> 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.

What exactly do you mean by "wasn't giving either one the seed"?
Randomu cannot be called without a seed argument, so what were you
using?

Did you see randomu's help for the explanation of how the seed
variable works, in all the different ways it can assume?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how smooth surface
Next Topic: Randomu() behavior - BAD!

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

Current Time: Fri Oct 10 05:22:45 PDT 2025

Total time taken to generate the page: 0.16185 seconds