LB Booster
Programming >> Liberty BASIC language >> True Random Numbers? http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1441877387 True Random Numbers?
Post by Monkfish on Sep 10th, 2015, 09:29am
My code simply uses Rnd(1) to select two entries from a list. Is there any advantage to using true random numbers as opposed to pseudo generated ones? Would the pseudo ones demonstrate a bias for certain digits?
Is there any way to use Intel's RdRand instruction?
Thank you
Re: True Random Numbers?
Post by Richard Russell on Sep 10th, 2015, 9:27pm
Would the pseudo ones demonstrate a bias for certain digits?
LB 4.04's RND function is known to be weak, with a definite bias (and presumably LB 4.0.5 is the same). LBB's RND is far better: it uses a well-established algorithm (a Linear Feedback Shift Register) that is known to have good statistical properties. The sequence length is 2^33-1, i.e. after that number of values have been generated the sequence repeats.
Quote:
Is there any way to use Intel's RdRand instruction?
Definitely, if it's supported by your CPU. But another option is to call the Windows CryptGenRandom API function, which should be good enough for most purposes.