These functions are often the guts of a simulation. These are all case functions.
random( ) |
A random number between 0 and 1. |
random( max ) |
A random (real) number between 0 and max. |
random( min, max) |
A random (real) number between min and max. |
randomInteger(min, max) |
A random integer between its two arguments, inclusive. Example: randomInteger(1, 6) gives 1, 2, 3, 4, 5, or 6 , chosen at random. |
randomPick(a1, a2, … ) |
This function gives you an element randomly chosen from the list of up to 20 arguments. Examples: randomPick( 1, 2, 3, 4, 5,
6) makes a die |
randomBinomial( n, p) |
This function gives you a random integer from a binomial distribution. Example: randomBinomial ( 20, 0.5) gives the number of heads in 20 tosses of a fair coin |
randomNormal(mu, sd) |
A random real number pulled from a normal distribution. Example: randomNormal(0, 1) gives you a number from a distribution with a mean of 0 and a standard deviation of 1. |
randomGeometric( p ) |
A random non-negative integer from a geometric distribution. You can think of the result as the number of turns it takes before you "catch" the case if the probability of catching it is the argument. Catching on the first try yields 0. |
randomExponential( mu ) |
A random real greater than zero, pulled from a distribution that declines exponentially (so there are more near zero, just like the geometric distribution). The larger the argument, the shallower the curve. Some people use the reciprocal of mu as the argument of their exponential distributions. |
In addition, every distribution Fathom supports also has a random number function.