The federal government has changed criminal code 207(4) c to allow the provinces the right to allow charitable gaming on or through a computer. This change opens the door for charities to adopt the use of random number generators (RNGs) for their raffles in Canada. In many US jurisdictions this is already a reality. Random number generators can be utilized to ascertain the winner of a raffle, by simply (or not so simply) choosing at random a ticket from a set of tickets. This can greatly reduce the administration expenses of a raffle. It saves charities the cost and time involved in printing ticket stubs and having a manual draw.
Many regulators also enjoy the federal criminal code changes as it adds a level of supervision and accountability derived, from having audit logs on the RNG draw process. These advantages don’t come without their challenges however and all regulators put the safety of the public first and foremost. This article highlights and addresses some of these challenges…
The caveat here is I am not an engineer, however I have done my best to explain a very technical specialized area of mathematics.
When discussing single numbers, a random number is one that is drawn from a set of possible values, each of which is equally probable, i.e., a uniform distribution. When discussing a sequence of random numbers, each number drawn must be statistically independent of the others.
Ironically, Computers are the Problem
Here’s the problem….computers are deterministic, which means that if you ask the same question, you’ll get the same answer every time. You can program a computer to generate a random number or numbers, but the machine is at the mercy of the rules of its programming. Although on the surface, a random sequence of numbers may be generated, the computer is following an algorithm and if it’s following a defined and consistently repeated algorithm, the number it produces are not truly random. The results may be complex and close to impossible to identify any patterns, but if you know the algorithm and the ‘seed’, results can be computed/predicted.
This kind of algorithm would be considered a pseudo-random number generator (PRNG). Essentially, PRNGs are algorithms that use mathematical formulae or simply pre-calculated tables to produce sequences of numbers that appear random. Nowadays generating pseudo-random numbers are so good that the numbers look exactly like they were really random even though they are not. A truly random generated number is…yes you guessed it; it is called a true random number generator (TRNG)
There are ways that machines can generate truly random numbers. And the importance of true randomness can be demonstrated in the following example: If you go to an online poker site, and you know the algorithm and seed, you can write a program that will predict the cards that are going to be dealt. Truly random numbers make such reverse engineering impossible.
The basic difference between PRNGs and TRNGs is easy to understand if you compare computer-generated random numbers to rolls of a die. Because PRNGs generate random numbers by using mathematical formulae or pre-calculated lists, using one corresponds to someone rolling a die many times and writing down the results. Whenever you ask for a die roll, you get the next on the list. Effectively, the numbers appear random, but they are really predetermined. TRNGs work by getting a computer to actually roll the die — or, more commonly, use some other physical phenomenon that is easier to connect to a computer than a die is.
In comparison with PRNGs, TRNGs extract randomness from physical phenomena and introduce it into a computer. You can imagine this as a die connected to a computer, but typically people use a physical phenomenon that is easier to connect to a computer than a die is. Radioactive decay is completely unpredictable, and they can be detected and used by a computer. Another common physical phenomenon utilized is atmospheric noise, which can be picked up and also fed into a computer.
It’s Ok. Here’s the Answers:
If you’re still with me, and this article isn’t clear as mud, it should be obvious that a true random number generator would be better than a pseudo random number generator for gambling/raffle/lottery purposes. This isn’t very practical however. TRNG’s generally aren’t very efficient. To maintain the efficiency of using a PRNG, protocols have to be put in place and the RNG should be certified by an independent testing lab.
The use of a PRNG should result in the selection of raffle outcomes in which the selection shall:
- Be statistically independent;
- Conform to the desired random distribution;
- Pass various recognized statistical tests; and
- Be unpredictable.
To achieve the above outcomes, the four main factors to ensure unpredictability are:
1. Background RNG Cycling/Activity Requirement
In order to ensure that RNG outcomes cannot be predicted, adequate background cycling / activity must be implemented between each drawing at a speed that cannot be timed. The rate of background cycling / activity must be sufficiently random in and of itself to prevent prediction.
2. RNG Seeding/Re-Seeding
The methods of seeding or re-seeding implemented in the RNG must ensure that all seed values are determined securely, and that the resultant sequence of outcomes is not predictable. a) The first seed shall be randomly determined by an uncontrolled event. For a multi-event raffle, after every raffle ticket draw, there shall be a random change in the RNG process (new seed, random timer, delay, etc.). This will verify the RNG doesn’t start at the same value, every time. It is permissible not to use a random seed; however, the manufacturer must ensure that the selection process will not synchronize. b) Unless proven to have no adverse effect on the randomness of the RNG outcomes, or actually improve the randomness of the RNG outcomes, seeding and re-seeding must be kept to an absolute minimum. If a multi-event raffle and if for any reason the background cycling / activity of the RNG is interrupted, the next seed value for the RNG must be a function of the value produced by the RNG immediately prior to the interruption.
3. Scaling Algorithms
The methods of scaling (i.e. converting raw RNG outcomes of a greater range into scaled RNG outcomes of a lesser range) must be linear, and must not introduce any bias, pattern or predictability. The scaled RNG outcomes must be proven to pass various recognized statistical tests.
After you get all that in place, the test laboratory may employ the use of various recognized tests to determine whether or not the random values produced by the random number generator pass the desired confidence level of 99%.
- a) Chi-square test; b) Equi-distribution (frequency) test; c) Gap test; d) Overlaps test; e) Poker test; f) Coupon collector’s test; g) Permutation test; h) Kolmogorov-Smirnov test; i) Adjacency criterion tests; j) Order statistic test; k) Runs tests (patterns of occurrences should not be recurrent); l) Interplay correlation test; m) Serial correlation test potency and degree of serial correlation (outcomes should be independent of the previous game); n) Tests on subsequences; and o) Poisson distribution.
Wrapping it Up
So basically after you have passed all the probing tests from the independent lab, and have a random number generator that is almost impossible to predict, regulators have to be confident that the charity is using the same RNG that was submitted and utilized in the proper fashion. The RNG must be a controlled component and must be a part of the overall system which adheres to program storage device standards such as authentication, error checking, audit logs etc.
If the charity has done all of the above, I am willing to make the prediction, you can’t predict the winner, but give it a shot….and best of luck to you…after all it’s for charity!!!