SEEDRND bug?

Previous topic - Next topic

FutureCow

Not sure if this is technically a bug (it depends on how you view random number generators!)

In most languages, seeding the random number generator with the same number each time you run the program results in a "predictable" random number set. Trying the following in GLBasic though
Code (glbasic) Select
SEEDRND 1234
PRINT "A random number between 0 and 100: " + RND(100), 100, 100
SHOWSCREEN


you get a different random number each time you run the program.  I would expect with seeding the generator to get the same number every time.

Kitty Hello

oops, that seems strange now.

Moru

As you say, in most languages it gives the same random numbers if you use the same seed. But not in all so I just thought this was one of the languages that don't :-)

FutureCow

I thought the same thing, but then realised - if RND always starts with a new seed, what's the point of having a SEEDRND function at all?

Kitty Hello

forgot to re-initialize the structure. Next version will work as expected.

FutureCow

Great work as always Gernot!