[Oberon] Random numbers

Rob Solomon drrob106 at verizon.net
Fri Sep 26 04:18:53 MEST 2008

On Thu, 2008-09-25 at 09:59 -0500, Martin Bishop wrote:
> 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.
> > 

> 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.

I have modula-2 source for code I wrote myself, if you need it

More information about the Oberon mailing list