vpFREE2 Forums

Digest Number 822

Sorry, I don't know exactly how they test it, but I do know from experience and from reading a lot about RNG algorithms, you can not be sure how good a RNG is by examining the algorithm. Creating a good RNG is largely a matter of trial and error. You take an algorithm that has been shown to work well and test it with different seeds.

An early algorithm (circa 1950's) was the center square method. You take the seed number, square it, and take the center bits as your result and next seed. For example suppose your processor can multiply two 32-bit numbers for a 64-bit result. Start with a seed number, multiply it by itself, and then take bits 16 - 47 of the product as the new seed. Intuitively, this seemed like a good method, but it turned out to have a very short cycle and clumpy results.

The algorithm I prefer is called multiplicative-congruential. Take the seed, multiply it by a constant, then divide by another much larger constant which is a prime number (or at least has no divisors common with the first constant). Ignore the quotient, and use the remainder of the division as the new random number and seed for the next iteration.

Now pick your constants, generate millions of numbers, and use various tests to see if the results are random enough for the purpose for which it is intended. If not, try different constants. Most high level languages have a MOD (modulo) function that gives the remainder of a division. Here is a good RNG that has been well tested:

RandNum = RandNum * 125 MOD 2796203

I have published several articles in Video Poker Times about RNG's, how they are tested, and how they are used in VP machines to shuffle the cards.

Dan

ยทยทยท

At 12:06 PM +0000 4/25/03, vpFREE@yahoogroups.com wrote:

Hey Dan, do you know how they test for this, or do they examine the
algorithm?

Jim

--

Dan Paymar, author of the book, "Video Poker - Optimum Play"
Editor and Publisher of "Video Poker Times" newsletter
Web site at http://www.OptimumPlay.com

"Chance favors the prepared mind."
-- Louis Pasteur