Generating Random numbers to conform a distribution

Richard Gaskin ambassador at fourthworld.com
Wed Jun 8 02:05:21 EDT 2022


Rick Harrison wrote:

 > Try rolling 2 six-sided dice.  7 is the number that appears the
 > most so it’s at the middle of the curve, while 2 and 12 are at
 > the ends of the distribution.  Roll the dice multiple times to
 > generate a distribution.
 >
 > Now simulate rolling the dice with random numbers in LC the same way.
 >
 > Now conduct your own experiments, and graph your results.


I've been poking at some of that now and then for prototyping board 
games in software (an ironic moment after all these years of making 
paper prototypes of what later becomes software <g>).

For my needs I found the simplest way to get the same results in LC as 
with dice was to do what dice do: use "any" in a range of six, iterated 
by the number of virtual dice.

There's probably a more clever mathy solution, but for my modest 
prototypes it helps me to keep the virtual implementation as close to 
the physical tabletop result as close as possible anyway, so I have a 
justification for making software that behaves no smarter than cardboard. :)


When I was making a game for a friend last summer I fell in love with 
the Royal Game of Ur (RGoU)- good history with an online version here 
for those interested:

https://royalur.net/

The dice used in RGoU are binary in range, tetrahedra with the faces 
blank and two of the four points painted.

The game is played with four of those, delivering a range of 0 through 4 
on a probability distribution of:

Dice Result   Likelihood
0             1
1             4
2             6
3             4
4             1

Or more graphy:

       +
       +
    +  +  +
    +  +  +
    +  +  +
+  +  +  +  +
0  1  2  3  4


If you ever need to plot dice probabilities, this tool handles nearly 
any number of any type of dice you can think of (except Ur dice, it 
turns out, but oh well):

https://anydice.com/

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com



More information about the use-livecode mailing list