Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You're quite right. When you use a single dice (twelve sided) the probability of getting any number (1 to 12 inclusive) is just 1/12. When you use two dices of 6 sides each the probability of each number is markedly different.
Value Probability Combinations 1 0 2 1/36 1:1 3 2/36 1:2, 2:1 4 3/36 1:3, 2:2, 3,1 5 4/36 1:4, 2:3, 3:2, 4:1 6 5/36 1:5, 2:4, 3:3, 4:2, 5:1 7 6/36 1:6, 2:5, 3:4, 4:3, 5:2, 6:1 8 5/36 2:6, 3:5, 4:4, 5:3, 6:2 9 4/36 3:6, 4:5, 5:4, 6:3 10 3/36 4:6, 5:5, 6:4 11 2/36 5:6, 6:5 12 1/36 6:6
Of course, if you're not using a truely random or very, very convincing pseudo-random generator you probably won't quite get these probabilities.

Considering that 7 is a bad number to get in Craps, it'd be nicer to use just a 12 sided dice, but then the Casinos would have to rig the game another way to get their money. ;)

It's good to know that for this kind of example rand() is as good as Math::Random.

jarich


In reply to Re: Re: Re: check my logic & a random number issue by jarich
in thread check my logic & a random number issue by rmckillen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-03-28 19:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found