Rolling Any-Sided Die: Probability and Randomization

In summary, the conversation discusses the process of generating random numbers and the probability of getting certain results, comparing it to rolling a die. The participants also discuss the idea of creating a program to emulate human rolling for a game and the possible flaws in this approach. They also touch on the concept of bias in observations and the importance of data in determining patterns.
  • #1
ComputerGeek
383
0
I am constructing a program that will roll a die of any size (up to what ever limit the computer system can use for random numbers)

is generating a random number than then looking at it mod 6 probabilistically the same as rolling a 6 sided die?
 
Mathematics news on Phys.org
  • #2
no , because some times you will get zero as a result for mod , and you will never get 6 (:

so you must add 1 to the final answer (:
 
  • #3
well.. true, but it is still 1/6 chance of getting each member of the set as with a die roll. correct? I am pretty sure it is, (as long as I pic my upper limit well I suppose)
 
  • #4
ComputerGeek said:
well.. true, but it is still 1/6 chance of getting each member of the set as with a die roll. correct? I am pretty sure it is, (as long as I pic my upper limit well I suppose)

You need each residue class to have the same probability of being selected, that's all.
 
  • #5
That will work just fine because you have 6 equally likely outcomes (0, 1, 2, 3, 4 and 5).
 
  • #6
you know what I am finding though, real world roles tend to produce more consistent results than computer generated roles.

some one who roles a 5 seems to have a better chance of re-roling a 4,5,or 6 than a 1, 2, or 3 (depending on the rolling method).

what do you think?
 
  • #7
ComputerGeek said:
you know what I am finding though, real world roles tend to produce more consistent results than computer generated roles.
some one who roles a 5 seems to have a better chance of re-roling a 4,5,or 6 than a 1, 2, or 3 (depending on the rolling method).
what do you think?

There are, of course, limitations on how well people roll. If people roll well, say by using a dicing cup and shaking it for a while, then you're likely to get reasonable results. Throwing by hand isn't nearly so good.

As a note, random number generators typically return results that are in the range [itex][0,2^{n-1}[/itex] which is obviously not divisible by six. If you *really care* you have to account for that.
 
  • #8
well, the rand function in perl generates a floating point number. but I changed my algorithm to just generate a random number of the size limits I am looking for rather than moding a large random number.

I am looking to make a program that is in fact less perfect in order to emulate human rolling. It is to replace game dice for D and D :-p.

Good randomness is proper for somethings.. not role playing though :-D
 
  • #9
ComputerGeek said:
you know what I am finding though, real world roles tend to produce more consistent results than computer generated roles.

some one who roles a 5 seems to have a better chance of re-roling a 4,5,or 6 than a 1, 2, or 3 (depending on the rolling method).

what do you think?

I would think your dice are unbalanced or they aren't really "rolling" the dice or you don't have a very large sample size and/or are just going on anecdotal evidence.

Dice don't remember the last thing they rolled (barring unusual damage to the die).
 
  • #10
ComputerGeek said:
well, the rand function in perl generates a floating point number. but I changed my algorithm to just generate a random number of the size limits I am looking for rather than moding a large random number.
I am looking to make a program that is in fact less perfect in order to emulate human rolling. It is to replace game dice for D and D :-p.
Good randomness is proper for somethings.. not role playing though :-D
I can't imagine how you might do/find such a thing, even in theory.

"less than perfect" is meaningless unles you can determine the causes and effects.

In what way do humans roll imperfectly? Higher than average? Lower? Excess repeats?

This seems a bizarre thing to try to attain. Personally, I would bet it is based on a flawed concept. I'll bet the patterns you are perceiving are illusory.
 
  • #11
oh, well you have to include the "roll it really eccentrically" kind of rolls.
 
  • #12
ComputerGeek said:
oh, well you have to include the "roll it really eccentrically" kind of rolls.

What is a "roll it really eccentrically" kind of roll? The kind where the person is trying to cheat? You will have to deliberately work at it to get rolls that are non-random (assuming decently "fair" dice).
 
  • #13
shmoe said:
What is a "roll it really eccentrically" kind of roll? The kind where the person is trying to cheat? You will have to deliberately work at it to get rolls that are non-random (assuming decently "fair" dice).
I'm with you. I dispute the suggested ability for a player to alter the randomness of the dice toss (except perhaps with a seriously blatant attempt to drop a single die at a time without rolling them).

And even if I concede on that, I also dispute the ability to then quantify cause and effect of that in a way that is of any use in a program.

I think my first requirement for even the most perfunctory look at this would require an explanation of what kind of deviation from randomness you expect to see.

Are we talking a repitition of rolls?


(Hm. 'dispute', 'concede','require'. Don't mean to sound so condescending...)
 
  • #14
ComputerGeek said:
you know what I am finding though, real world roles tend to produce more consistent results than computer generated roles.
some one who roles a 5 seems to have a better chance of re-roling a 4,5,or 6 than a 1, 2, or 3 (depending on the rolling method).
what do you think?

The operative word is "seems." Let's see some data! :)
 
  • #15
ComputerGeek said:
you know what I am finding though, real world roles tend to produce more consistent results than computer generated roles.
some one who roles a 5 seems to have a better chance of re-roling a 4,5,or 6 than a 1, 2, or 3 (depending on the rolling method).
what do you think?
That's a flaw in your observation techniques, not in the actual phenomenon.

It's the same principal as "more babies are born under a full Moon" and "more crimes happen under a Full Moon".

It's perceptual. Humans make patterns where there are none. How many times have you (or anyone you know) heard of the birth of a baby and said "Say, that's the third baby this year born under a waning cresecent Moon!"

Your brain is noticing the closness between the "5" and the subequent "4", "5" or "6". Your brain doesn't bother noticing a "5" followed by a "1" "2" or "3".

Give us numbers. Roll (or have your friends roll) a die a hundred times. Post the data. We'll analyze it together.



P.S. As one "roll"-player to another ... "roll" is dice. "role" is people. :wink:
 
  • #16
Don't forget to seed the random number generator, or you may see the same patterns over and over again. At least that's how it works in Visual Basic. I'm not sure about Perl.

Just because you look at the data and it seems non-random doesn't mean that it is non-random. Random groups of numbers should have repeats and lots of other coincidences embedded in it. There's a web page that gives the value of pi to 1 million digits. I did a ctrl+F and found my phone number.
 
  • #17
tony873004 said:
There's a web page that gives the value of pi to 1 million digits. I did a ctrl+F and found my phone number.

Cool!

BTW, this page http://www.angio.net/pi/piquery" will do the search for you, and it searches up to 200 million digits.

I am at 7,812,036 and 36,412,751 - (home and cell phone respectively)*. I had to use only 7 digits. My 10-digit numbers weren't to be found**.

And now, with a little effort, you know my phone numbers... something else that page does...


**And there's a handy chart to show why a 10-digit number will likely not be found:
Number Length Chance of Finding
-------------- -----------------
1-5...100%
6.....Nearly 100%
7.....99.995%
8.....63%
9.....9.5%
10...0.995%%
11...0.09995%
 
Last edited by a moderator:
  • #18
One thing I have noticed in dice is how frequently a number is followed by the same, say in the roll: 2,4,5,5.

One might expect that the chance of getting a 5 twice is 1/36, but that is not the case above. The fact is that the chance that X is follow by X is one chance in 6.
 
  • #19
robert Ihnot said:
One thing I have noticed in dice is how frequently a number is followed by the same, say in the roll: 2,4,5,5.
One might expect that the chance of getting a 5 twice is 1/36, but that is not the case above. The fact is that the chance that X is follow by X is one chance in 6.

It's actually the same thing. The chance of getting a 5 twice is 1/36. X followed by X is one in six, but X doesn't have to be 5. It could be 1,2,3,4,5 or 6.

So pairs should 1/6, and pairs of 5's should be 1/36.
 
  • #20
in perl 5 rand is already seeded. if you want it to be compatible with older perl versions, then you have yo use srand first to seed it and then you can use rand.
 

1. What is the probability of rolling a specific number on a six-sided die?

The probability of rolling a specific number on a six-sided die is 1/6, or approximately 16.67%. This is because there are six possible outcomes (the numbers 1 through 6) and each outcome has an equal chance of occurring.

2. What is the expected value of rolling a six-sided die?

The expected value of rolling a six-sided die is 3.5. This means that if you were to roll the die an infinite number of times, the average of all the outcomes would be 3.5. This is calculated by adding up all the possible outcomes (1 + 2 + 3 + 4 + 5 + 6) and dividing by the number of outcomes (6).

3. Can the outcome of rolling a die be predicted?

No, the outcome of rolling a die cannot be predicted. Each roll is completely random and independent of previous rolls. Even if a certain number has not been rolled in a while, the probability of rolling that number on the next roll is still 1/6.

4. How does rolling multiple dice affect the probability?

Rolling multiple dice does not affect the probability of rolling a specific number on one die. However, it does affect the overall probability of a certain combination of numbers occurring. For example, the probability of rolling a total of 7 when rolling two six-sided dice is 1/6, while the probability of rolling a total of 2 is only 1/36.

5. How does the shape and weight of a die affect the probability?

The shape and weight of a die can affect the probability of certain numbers being rolled, but only if it is not a fair die. A fair die is one where all the outcomes have an equal chance of occurring. If a die is weighted or has uneven sides, it can change the probability of certain outcomes. However, for a fair die, the shape and weight will not affect the probability.

Similar threads

  • General Math
Replies
1
Views
4K
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
  • General Math
Replies
1
Views
2K
  • Precalculus Mathematics Homework Help
2
Replies
53
Views
5K
Replies
1
Views
2K
  • General Math
Replies
1
Views
1K
Replies
17
Views
7K
  • Precalculus Mathematics Homework Help
Replies
11
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
11
Views
504
Replies
11
Views
2K
Back
Top