The Law of Averages.
-
The Law of Averages is cool. In developing my board game I had to make sure their wasn't any numbers that would be favored above other ones on a roll of 2 dice. After 360 rolls the average number of times each combonation was rolled was exactly 10.0. Exactly! That's so weird. It's supposed to be random! Kudos to God for making such an ordered universe. :omg: Why not throw away a dime? I throw away ten pennies all the time.
kevnar wrote: After 360 rolls the average number of times each combonation was rolled was exactly 10.0. Exactly! If this happens more than once in your life, there's something wrong. honestly.
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]
-
It was randomized to the computers clock. Why not throw away a dime? I throw away ten pennies all the time.
The stdlib: rand() implementations are usually not "that good". They are ok for making things lok random, but for statistic purposes they are out. Knuth 1 still has the best introduction to PRNG IMO.
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]
-
Michael Dunn wrote: Try 3.6 million The bigger the number the more evenly the distributions :-) Tell him to try 2 ;-) Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
-
The stdlib: rand() implementations are usually not "that good". They are ok for making things lok random, but for statistic purposes they are out. Knuth 1 still has the best introduction to PRNG IMO.
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]
Even box-muller routines are frowned upon. See Wilmott.com Alice thought that running very fast for a long time would get you to somewhere else. " A very slow kind of country!" said the queen. "Now, here , you see, it takes all the running you can do, to keep in the same place".
-
kevnar wrote: After 360 rolls the average number of times each combonation was rolled was exactly 10.0. Exactly! If this happens more than once in your life, there's something wrong. honestly.
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]
Try it for yourself. I made a 6 by 6 grid with 1 to 6 on the top and 1 to 6 down the side and then I rolled two dice and stacked a hypothetical chip in the square at the rolled coordinates. Then I took the average numerber of chips in each of the 36 grid squares. It was all over the place in the first hundred trials or so, but eventually it averaged out to an even 10.0 for 360 rolls. I tried it over and over and it always came out to 10.0. I was so amazed that I double checked my code to make sure I hadn't made a mistake. It's all good. Can it be wrong in exactly the same way over and over again? Why not throw away a dime? I throw away ten pennies all the time.
-
Try it for yourself. I made a 6 by 6 grid with 1 to 6 on the top and 1 to 6 down the side and then I rolled two dice and stacked a hypothetical chip in the square at the rolled coordinates. Then I took the average numerber of chips in each of the 36 grid squares. It was all over the place in the first hundred trials or so, but eventually it averaged out to an even 10.0 for 360 rolls. I tried it over and over and it always came out to 10.0. I was so amazed that I double checked my code to make sure I hadn't made a mistake. It's all good. Can it be wrong in exactly the same way over and over again? Why not throw away a dime? I throw away ten pennies all the time.
it's not that it's wrong (it's absolutely correct - each combo has the same probability) so much as that it's just highly improbable (or lucky, if you prefer) that you'd see it with so few samples. -c
Cheap oil. It's worth it!
Image Processing - just like mom used to make.
-
Try it for yourself. I made a 6 by 6 grid with 1 to 6 on the top and 1 to 6 down the side and then I rolled two dice and stacked a hypothetical chip in the square at the rolled coordinates. Then I took the average numerber of chips in each of the 36 grid squares. It was all over the place in the first hundred trials or so, but eventually it averaged out to an even 10.0 for 360 rolls. I tried it over and over and it always came out to 10.0. I was so amazed that I double checked my code to make sure I hadn't made a mistake. It's all good. Can it be wrong in exactly the same way over and over again? Why not throw away a dime? I throw away ten pennies all the time.
int board[6][6];
void Play()
{
srand(time(NULL)); // <-- re-seed the generator
memset(board, 0, sizeof(board));
for(int i=0; i<360; ++i) {
int x = rand() % 6;
int y = rand() % 6;
board[x][y] += 1;
}
}**typical results:
15 3 9 4 8 8 8 12 5 18 13 11 5 11 8 12 9 5 13 13 8 11 15 8 15 9 10 14 12 11 8 10 9 8 12 10
12 6 10 9 9 7
8 12 11 12 15 5
12 5 15 10 8 11
5 14 7 15 8 12
10 13 9 15 6 7
7 11 13 15 10 6These distributions are "normal", you will see similar if you use real dice. of course if you're lucky, you can get an all-tens, but this is highly unlikely.
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]**
-
Try it for yourself. I made a 6 by 6 grid with 1 to 6 on the top and 1 to 6 down the side and then I rolled two dice and stacked a hypothetical chip in the square at the rolled coordinates. Then I took the average numerber of chips in each of the 36 grid squares. It was all over the place in the first hundred trials or so, but eventually it averaged out to an even 10.0 for 360 rolls. I tried it over and over and it always came out to 10.0. I was so amazed that I double checked my code to make sure I hadn't made a mistake. It's all good. Can it be wrong in exactly the same way over and over again? Why not throw away a dime? I throw away ten pennies all the time.
kevnar wrote: I tried it over and over and it always came out to 10.0. You're seeding your random number generator with the same value every time ;P :-D --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Sonork-100.19012 Acid_Helm
-
int board[6][6];
void Play()
{
srand(time(NULL)); // <-- re-seed the generator
memset(board, 0, sizeof(board));
for(int i=0; i<360; ++i) {
int x = rand() % 6;
int y = rand() % 6;
board[x][y] += 1;
}
}**typical results:
15 3 9 4 8 8 8 12 5 18 13 11 5 11 8 12 9 5 13 13 8 11 15 8 15 9 10 14 12 11 8 10 9 8 12 10
12 6 10 9 9 7
8 12 11 12 15 5
12 5 15 10 8 11
5 14 7 15 8 12
10 13 9 15 6 7
7 11 13 15 10 6These distributions are "normal", you will see similar if you use real dice. of course if you're lucky, you can get an all-tens, but this is highly unlikely.
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]**
You guys don't get what I'm saying. I'm not saying all the grid squares were ten, I'm saying the average was always 10. Add all these numbers up and divide by 36. It's gonna be 10, or pretty close to it. The more trial rolls you do, the closer it is to the perfect average(number of trials divided by 36, 10 in the case of 360 rolls). The same holds true for real dice. Although I have no desire to sit there and roll real dice all night. Why not throw away a dime? I throw away ten pennies all the time.
-
kevnar wrote: I tried it over and over and it always came out to 10.0. You're seeding your random number generator with the same value every time ;P :-D --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Sonork-100.19012 Acid_Helm
-
You guys don't get what I'm saying. I'm not saying all the grid squares were ten, I'm saying the average was always 10. Add all these numbers up and divide by 36. It's gonna be 10, or pretty close to it. The more trial rolls you do, the closer it is to the perfect average(number of trials divided by 36, 10 in the case of 360 rolls). The same holds true for real dice. Although I have no desire to sit there and roll real dice all night. Why not throw away a dime? I throw away ten pennies all the time.
Ah, ok that makes more sense, but I am still :confused: (could you please post code? I sometimes have trpoubles with plain english ;) If you throw the dice exactly 360 times, and add a chip to the board each time, you will have 360 chips on the board - even if you throw the dice *away* and just stack them all on one quare. If you add all fields up and divide by 36, you will get 10. (is it this what you're referring to?) Now I'm puzzled that you sometimes do *not* get a perfect 10.... might be there's an roundin error involved, or I still don't get what you mean... :confused: :cool:
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]
-
Ah, ok that makes more sense, but I am still :confused: (could you please post code? I sometimes have trpoubles with plain english ;) If you throw the dice exactly 360 times, and add a chip to the board each time, you will have 360 chips on the board - even if you throw the dice *away* and just stack them all on one quare. If you add all fields up and divide by 36, you will get 10. (is it this what you're referring to?) Now I'm puzzled that you sometimes do *not* get a perfect 10.... might be there's an roundin error involved, or I still don't get what you mean... :confused: :cool:
Back in the days before yer Gighertz and Teraflops there was something we old timers called paranoia. Andrew Torrance, The Lounge [sighist]