Page 1 of 1

How can I avoid the string of Random numbers repeating in QB64?

Posted: Fri Jan 23, 2015 11:49 pm
by rockyabq
Brand, spankin' newbie here...

I'm simulating randomly created striations (scratches) on a pair of bullets and comparing them. This requires huge invocations of RND. There are 300 possible sites on each pair that are chosen to be either striation or non-striation using RND. After half a million or so pairs of bullets, the patterns generated recur because the length of the string of pseudo-random numbers that QB can make has been exceeded and the numbers begin to repeat. It makes no difference whether I RANDOMIZE with a seed number or with RANDOMIZE TIMER. I tried a line to the effect of IF RND>.95 THEN RANDOMIZE TIMER. No help. Any ideas?

Thanks in advance,
Rocky

Re: How can I avoid the string of Random numbers repeating in QB64?

Posted: Sat Jan 24, 2015 9:50 am
by burger2227
Random numbers repeat themselves at times eventually and with QB there is no way around it.

You could try to seed the numbers using TIMER which should give you a more random starting point but you will never be 100% happy as random repeats itself in real life.

QB64 can use RANDOMIZE USING seednumber also to repeat a new number series. You could try that, but they all repeat themselves eventually.