GLBasic forum

Main forum => Bug Reports => Topic started by: FutureCow on 2009-Sep-17

Title: SEEDRND bug?
Post by: FutureCow on 2009-Sep-17
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.
Title: Re: SEEDRND bug?
Post by: Kitty Hello on 2009-Sep-17
oops, that seems strange now.
Title: Re: SEEDRND bug?
Post by: Moru on 2009-Sep-17
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 :-)
Title: Re: SEEDRND bug?
Post by: FutureCow on 2009-Sep-17
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?
Title: Re: SEEDRND bug?
Post by: Kitty Hello on 2009-Sep-17
forgot to re-initialize the structure. Next version will work as expected.
Title: Re: SEEDRND bug?
Post by: FutureCow on 2009-Sep-17
Great work as always Gernot!