|We don't bite newbies here... much|
Re: Re: check my logic & a random number issueby Daruma (Curate)
|on Oct 11, 2002 at 05:19 UTC||Need Help??|
PPS: FWIW in the interests of not installing more stuff, my roll function came out to be:
After reading your node, jarich, I began wondering how different Math::Random, int(rand(6)) and int(rand(12)) might be... I noted your suggested rolldice() subroutine quoted above. To appropriately spread the roll result to mimic a table craps game, there should be a curve peaking at seven. I decided to slap together a quick test...
And here is the output:
So, using one die rather than two has a tremendous impact on the spread of the numbers! Additionally, I noted that the differences between using Math::Random and int(rand(6)) were fairly slight. After running the above code over numerous tests, I found them to be quite comparable. In the interest of not installing more than is necessary, I would go with the int(rand(6)) rather than slurping in the Math::Random goodies.
Craps is my favorite Vegas game... I find it to be the most fun and exciting of all the games I've tried. (Probably more fun than it should be!)
Update: formatting changes and fixed reference to jarich's rand(12) usage... Thanks, jarich!!
Update2:Reworked my unnecessarily long code with a few loops...