Results 1 to 6 of 6
Thread: Random Numbers (Acc2k SR1)

20010712, 06:46 #1
 Join Date
 Jun 2001
 Location
 Edinburgh, Midlothian, Scotland
 Posts
 492
 Thanks
 0
 Thanked 0 Times in 0 Posts
Random Numbers (Acc2k SR1)
Anyone any good at statistics?.
I've set up a database which picks a prize winner each month using a Random Number generator, which I randomize each time before use.
As I was concerned about the true randomness, I set up a test, and ran the selector 250,000 times (I know, but it seemed like a good idea), to select a number between 1 & 211 (current membership).
The results showed an average of each number winning 1184.83 times which is what I would expect. However the highest was 1269, and the lowest 1086 (I don't really know enough about Standard Deviations, but the result was 34.878.
I must admit I was rather surprised at how wide the spread was, and assumed that as I had picked such a large number, the Max and Min would be much closer to the average (but I know nothing about stats). But it shows in this case that 1 number was selected 16% more than the lowest.
Is this in line with what would be expected statistically.
Since the monthly prize is reasonably large, I need to be confident that the selection is fair.

20010712, 15:49 #2
 Join Date
 Dec 2000
 Location
 Faifax, Virginia, USA
 Posts
 542
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: Random Numbers (Acc2k SR1)
I've done some work with random numbers, and there is some material on my website relating thereto. The majority of my use is for modeling physical properties, rather than 'people.'
However, if you want to be fair, then the only fair distribution of prizes is to list all of your members, and choose them each in turn.

20010712, 16:57 #3
 Join Date
 Jun 2001
 Location
 Edinburgh, Midlothian, Scotland
 Posts
 492
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: Random Numbers (Acc2k SR1)
Hi
Thanks for the comments.
I took a look at the site, but its well beyond my capabilities.
Interesting thought tho to allocate in turn. Kinda takes the fun away.

20010712, 17:08 #4
 Join Date
 Jun 2001
 Location
 Edinburgh, Midlothian, Scotland
 Posts
 492
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: Random Numbers (Acc2k SR1)
I posted this same message on a Statistics site, and got the response below as an answer, which seems to confirm my figures are indeed random.
Your approach actually was excellent. Most people take for granted that what a computer gives them is valid, but you should be commended for your approach to checking it.
Here's what you can do to see if your results depart from what can be attributed to chance (I assume you did this in Excel).
For each "bin" result (i.e., the number of occurrences for each of the possible 211 outcomes), subtract the mean from it, square this result, then divide it by the mean. Then add up all of these quantities. Basically the formula looks like this:
((OE)^2 / E)
where E is the expected, or mean frequency, and O is the observed frequency. You are running a chisquare test on your frequencies to see if they are close enough to a "random" outcome.
Now run the Excel function CHIDIST, with the two arguments for the function:
 the sum of all the ((OE)^2 / E) quantities
 degrees of freedom = 210, which is the number of bins minus 1
Generally, if the return value or answer for the function is .05 or greater, than you can call your results "random."
Remember, however, that computergenerated random numbers are actually "pseudorandom," meaning that they are determined by a computer algorithm, and they actually have a periodicity to them (the pattern will eventually go back to the beginning and repeat itself). However, this periodicity is usually in the billions, and will probably never occur under normal circumstances.

20010712, 19:18 #5
 Join Date
 Dec 2000
 Location
 Faifax, Virginia, USA
 Posts
 542
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: Random Numbers (Acc2k SR1)
'fun' has to be interpreted by everyone involved as 'fair'. Otherwise, you run the risk of a game perceived to be 'fixed.'
Perhaps an array of integers from 1..211, in random order is fun enough, and guaranteed that everyone wins over ~4 years, which is imminently fair.

20010713, 07:28 #6
 Join Date
 Jun 2001
 Location
 Edinburgh, Midlothian, Scotland
 Posts
 492
 Thanks
 0
 Thanked 0 Times in 0 Posts
Re: Random Numbers (Acc2k SR1)
I hope that most people who join a lottery understand that there is no guarantee that they will win. They also accept that someone may win twice, three or even more before they themselves win.
The whole point is that it should be random, and therefore someone can win for example in consecutive months. What I hoped to show was that over the long term, the selection was fair, and it seems to have done so.