[Oberon] Random numbers
martinbishop at bellsouth.net
Thu Sep 25 16:59:06 MEST 2008
Yaroslav Romanchenko wrote:
>> I have some simple code that does the Knuth shuffle on an array of
>> integers. I use RandomNumbers.RND(n + 1) (n being the FOR loops
>> counter), however every time I run the resulting program, it gives me
>> the same "random" shuffle. Even a recompile will still give me the same
>> shuffle. Is this a property of the random number generator? Do I have
>> to seed it myself with the time or something?
> Inspecting RandomNumbers module content shows that its seed value initializes only when module loaded first time.
> So, you can use RandomNumbers.InitSeed() every time it's needed.
> Cheers, SAGE
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
Ah, that's where the problem is. I'm using oo2c, and it's RandomNumbers
module doesn't have an InitSeed()
I'll look around at other sources for one, I suppose.
More information about the Oberon