My Math Forum  

Go Back   My Math Forum > High School Math Forum > Probability and Statistics

Probability and Statistics Basic Probability and Statistics Math Forum


Reply
 
LinkBack Thread Tools Display Modes
December 25th, 2016, 09:48 PM   #1
Newbie
 
Joined: Jul 2016
From: Santa Cruz CA

Posts: 4
Thanks: 0

Math Focus: Calculus
Lightbulb [HELP] Approximating arbitrary dice rolls

I'm working on a project where i need to be able to convert a random number generation into any arbitrary dice roll. Yes, I know about simply multiplying by the number of sides and then rounding/flooring/ceilinging the result. What i'm talking about is taking a random number and throwing it into an equasion to spit out a result that mimmics the probability distribution of say, roll XDY, keep highest, or keep lowest.

I've been wracking my brain over this for some time, and I'm sure that the input (X) will be an exponential value. it's likely something like: 1-rand()^x or something. I know that's totally wrong on all levels, but it should look kinda like that... ish, I think.

I need it to be accurate within lik 0.01 from actual, and it needs to be able to be done without integrals or summations or anything like that. so, logs and exponents are the highest it can go.

Not sure how usefull this is for other things, but at least it would be an interesting thing to try and figure out, I'll try and figure it out myself and if I figure it out, I'll post it here.
Raxmo is offline  
 
December 25th, 2016, 11:08 PM   #2
Newbie
 
Joined: Jul 2016
From: Santa Cruz CA

Posts: 4
Thanks: 0

Math Focus: Calculus
so, I have a solution, not really happy with it, but it works for what I need it to do

ceiling(if(k<0, x^|k-1|, else; 1-x^(k+1))*j)

where x is a randomly generated number, k is the level of iterations, and j is the value of the die. I've found that it is actually 100% accurate, but it's a little... ugly. If anyone else out there can come up with a far more elegant solution, don't hesitate to let me know!
Raxmo is offline  
December 25th, 2016, 11:16 PM   #3
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: CA

Posts: 1,202
Thanks: 613

can you use 2 random numbers?

let $d_1, d_2 \sim u[0,1]$ i.e. a uniform distribution on $[0,1]$

this is a typical RNG output

if you roll 2 separate dice via $\left \lfloor 6 d_1 \right \rfloor +1,~\left \lfloor 6 d_2 \right \rfloor +1$

and add them they will have the distribution you want.

Last edited by romsek; December 25th, 2016 at 11:18 PM.
romsek is offline  
December 26th, 2016, 12:31 AM   #4
Newbie
 
Joined: Jul 2016
From: Santa Cruz CA

Posts: 4
Thanks: 0

Math Focus: Calculus
Quote:
Originally Posted by romsek View Post
can you use 2 random numbers?

let $d_1, d_2 \sim u[0,1]$ i.e. a uniform distribution on $[0,1]$

this is a typical RNG output

if you roll 2 separate dice via $\left \lfloor 6 d_1 \right \rfloor +1,~\left \lfloor 6 d_2 \right \rfloor +1$

and add them they will have the distribution you want.
oh, yes indeed, if I had the luxury or for loops. or while loops. I need to plug a randomly generated number from 0-1, and it spit out the distribution I need. I'm basically trying to calculate "out of 10d6, which one was the highest?" while being able to arbitrarily set the number of dice used, and the value of the dice being used
Raxmo is offline  
December 26th, 2016, 02:25 AM   #5
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: CA

Posts: 1,202
Thanks: 613

Quote:
Originally Posted by Raxmo View Post
oh, yes indeed, if I had the luxury or for loops. or while loops. I need to plug a randomly generated number from 0-1, and it spit out the distribution I need. I'm basically trying to calculate "out of 10d6, which one was the highest?" while being able to arbitrarily set the number of dice used, and the value of the dice being used
ok

start from the beginning. forget about how you might calculate anything for a moment and tell me exactly what it is you want to do.

the "out of 10d6, which was the highest" is a start but I don't know what you mean by that. Be as general as you can be.
romsek is offline  
December 28th, 2016, 09:37 PM   #6
Newbie
 
Joined: Jul 2016
From: Santa Cruz CA

Posts: 4
Thanks: 0

Math Focus: Calculus
Quote:
Originally Posted by romsek View Post
ok

start from the beginning. forget about how you might calculate anything for a moment and tell me exactly what it is you want to do.

the "out of 10d6, which was the highest" is a start but I don't know what you mean by that. Be as general as you can be.
that's... prety much it. not sure how better to explain it. i'm trying to replicate XDY, keep highest, if you are at all familiar with dice notation. Again, I have a fix with the application I'm using it for, but still interested in if there is an actual formula for it or something.
Raxmo is offline  
December 28th, 2016, 10:14 PM   #7
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: CA

Posts: 1,202
Thanks: 613

Quote:
Originally Posted by Raxmo View Post
that's... prety much it. not sure how better to explain it. i'm trying to replicate XDY, keep highest, if you are at all familiar with dice notation. Again, I have a fix with the application I'm using it for, but still interested in if there is an actual formula for it or something.
so you want the most likely dice roll of nDk ?

it will be

$\begin{cases}n \dfrac{k+1}{2} &k\text{ odd} \\ \\

\left \lfloor n \dfrac{k+1}{2} \right \rfloor,~\left \lceil n \dfrac{k+1}{2} \right \rceil &k \text{ even} \end{cases}$

when $k$ is even those two dice rolls are equally likely
romsek is offline  
Reply

  My Math Forum > High School Math Forum > Probability and Statistics

Tags
approximating, arbitrary, dice, probability, rolls



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expected Value of Sum of A Number of Rolls of Dice adamwlev Advanced Statistics 1 March 25th, 2016 12:44 PM
Odds of sequential rolls of a set of three, 12-sided dice to achieve a 1, 5, 8 combo? AJJ Probability and Statistics 3 September 9th, 2015 12:35 AM
two rolls rolling a dice find odds sum is less than or equal to 5 mihaella27 Probability and Statistics 4 October 25th, 2014 04:02 PM
How to calculate the possibilities for dice rolls in RISK lo22 Algebra 4 January 25th, 2012 09:57 PM
55 dice rolls jonaseriksson Algebra 3 May 14th, 2011 07:06 AM





Copyright © 2017 My Math Forum. All rights reserved.