Re: [Oberon] Random numbers

Yaroslav Romanchenko tobject at bk.ru
Thu Sep 25 07:21:28 MEST 2008


> 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
http://sage.com.ua/



More information about the Oberon mailing list