Wilang Documentation1.0.0+4

Probability and random values#

Random values#

random() draws from [0,1). random(max) scales that to [0,max), and random(min,max) takes an exclusive upper bound. randomInt(min,max) picks whole numbers. Pass an array first to draw several at once, so random([1,2,3],2,5) gives three values in [2,5). pickRandom chooses one entry from a list. Every evaluation draws again.

Example
randomInt(1,7) >= 1 and randomInt(1,7) < 7

Counting#

combinations counts unordered selections and permutations counts ordered ones.

Example
combinations(10,3)
permutations(10,3)
factorial(5)

Computing a probability#

Combine a count with the arithmetic of the distribution. The probability of exactly three successes in ten independent trials, each with a success chance of 0.5, is:

Example
combinations(10,3) * 0.5^3 * (1-0.5)^7

What is available, and what is not#

The reference covers permutations, combinations with and without repetition, multinomial counts, gamma, the error function, and related functions. bernoulli(n) computes a Bernoulli number; it is not a distribution constructor.

The app does not supply distribution constructors. There is no normal, binomial, poisson, or uniform object with .pdf(), .cdf(), or .random(), so do not copy those examples from a JavaScript library into a math cell. Write the density expression yourself and plot it instead.

Predictable math settings do not seed random values. For a repeatable demonstration, save a fixed list of data rather than depending on a particular draw.

Statistics · All functions