@Fred: Questions about RandomSeed(), Random()
@Fred: Questions about RandomSeed(), Random()
Hi Fred.
1. What values make sense for RandomSeed() ? (0..2^31-1 ?)
2. What is the highest useful value for Random() ? (2^31-1 ?)
3. Any hint what kind of PRNG you are using?
Have a nice day,
Hades
1. What values make sense for RandomSeed() ? (0..2^31-1 ?)
2. What is the highest useful value for Random() ? (2^31-1 ?)
3. Any hint what kind of PRNG you are using?
Have a nice day,
Hades
Re: @Fred: Questions about RandomSeed(), Random()
RandomSeed(ElapsedMilliseconds()) or use a long.1. What values make sense for RandomSeed() ? (0..2^31-1 ?)
$7FFFFFFF or +2147483647 (it's a signed long)2. What is the highest useful value for Random() ? (2^31-1 ?)
Please correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
If that is not the case it sounds like a bug, but you can always test it.Hades wrote:Thank you for your answers.
to RandomSeed():
I have to be sure I can use at least 30 bit for the seed, and they are fully used by the PRNG (produce different, repeatable results). Does anybody know if that is the case?
This ..
Always gives me this ..
Always gives me this..
Code: Select all
RandomSeed(%111111111111111111111111111111)
For i = 1 To 20
Debug Random($7FFFFFFF)
Next- 1428841689
1400720876
2101687175
1376130085
509981955
1786875312
1012963906
743527194
1792047849
1862237268
1854146918
1918186864
634768099
2090250383
243859415
814637835
2055386557
230076762
681308473
415508342
Code: Select all
RandomSeed(%101010101010101010101010101010)
For i = 1 To 20
Debug Random($7FFFFFFF)
Next- 694093175
733968713
375167596
360530968
1269931708
162140230
1154304316
127478278
734274873
904269346
496657588
969237289
142867284
1356160719
830562000
1422205369
1447137896
40352398
520117975
282751248
@}--`--,-- A rose by any other name ..
Only thought I have on that is looping from min to max random seed and getting the first few results from each. Store results, look for duplicates, if there are dupes, use these in a smaller test with a larger sample.Hades wrote:@Dare2
Ok, but how do I know that there aren't other seeds, that give the same numbers?
Not too trivial a file size, though.
@}--`--,-- A rose by any other name ..



