My Math Forum [HELP] Approximating arbitrary dice rolls
 User Name Remember Me? Password

 Probability and Statistics Basic Probability and Statistics Math Forum

 December 25th, 2016, 08:48 PM #1 Newbie   Joined: Jul 2016 From: Santa Cruz CA Posts: 4 Thanks: 0 Math Focus: Calculus [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.
 December 25th, 2016, 10: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!
 December 25th, 2016, 10:16 PM #3 Senior Member     Joined: Sep 2015 From: USA Posts: 1,980 Thanks: 1027 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 10:18 PM.
December 25th, 2016, 11:31 PM   #4
Newbie

Joined: Jul 2016
From: Santa Cruz CA

Posts: 4
Thanks: 0

Math Focus: Calculus
Quote:
 Originally Posted by romsek 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

December 26th, 2016, 01:25 AM   #5
Senior Member

Joined: Sep 2015
From: USA

Posts: 1,980
Thanks: 1027

Quote:
 Originally Posted by Raxmo 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.

December 28th, 2016, 08:37 PM   #6
Newbie

Joined: Jul 2016
From: Santa Cruz CA

Posts: 4
Thanks: 0

Math Focus: Calculus
Quote:
 Originally Posted by romsek 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.

December 28th, 2016, 09:14 PM   #7
Senior Member

Joined: Sep 2015
From: USA

Posts: 1,980
Thanks: 1027

Quote:
 Originally Posted by Raxmo 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

 Tags approximating, arbitrary, dice, probability, rolls

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post adamwlev Advanced Statistics 1 March 25th, 2016 12:44 PM AJJ Probability and Statistics 3 September 9th, 2015 12:35 AM mihaella27 Probability and Statistics 4 October 25th, 2014 04:02 PM lo22 Algebra 4 January 25th, 2012 08:57 PM jonaseriksson Algebra 3 May 14th, 2011 07:06 AM

 Contact - Home - Forums - Cryptocurrency Forum - Top