probability

Make a yes-or-no decision with a given likelihood

The probablility P of something occurring is defined as the number of looked-for outcomes divided by the number of possible outcomes. For example, the probability that heads will show up on an unbiased coin flip is 1 (there is one instance of heads on the coin) divided by 2 (there are two possible outcomes, heads or tails), which means P = 0.5. With this definition, any probability can be described as a number in the range from 0 (impossible) to 1 (absolute certainty).

Pass a certain percentage of bangs

To make a random decision between two things, you can use the decide object. To make a probabilistic decision between two things, with one thing being more likely than the other, you can use the random object to choose randomly from a larger set of numbers, then assign a majority of those choices to mean one thing (and the remaining minority to mean the other thing). An easy way to do this is with the < object.

Random numbers without repetitions

The random object outputs a pseudo-randomly chosen integer. The range of possible numbers is determined by the number received in the right inlet (or specified as a typed-in argument). Each time random receives a bang, it will output one of n possible numbers, ranging from 0 to n-1. Because each number has an equal probability of occurring each time, there’s a possibility that repetitions will occur. If you wish to prevent repetitions there are two approaches.