- random object
The random object is a pseudo-random generator. random outputs a number between 0 and its argument-1. So random 10 will output numbers between 0 and 9 with equal probability each.
If what you are after is equal probability, use random.
You can add a select after random to get a bang when the random number matches the argument. For example, if you want a bang to choose randomly between three options you can use the construction in Figure 1.
- moses and stochastic procedures
A stochastic process is one where probabilities aren’t equal. We use a random generator to create an equal probability distribution, but then we use moses (we could also use the usual >, <=, etc…) to separate the incoming stream of numbers.
In figure 2 you can see the construction where you have two possible events, one of them is dominant 75% and the other has less chances (25%). the chances of the first happening over the second at a given bang are 3:1.
You can also create chains of moses objects to divide the incoming stream into more than two options.
- changing ranges
sometimes you want to generate a random value that you can use directly or add to a constant number to generate small variations.
To do this you will usually need to change the range of your random objects output.
Usually this has three steps: normalize, change range, and add a minimum value. In Figure 3, you can see how this is implemented.
- feedback
Finally, nothing says generative like feedback. For example you might not want to use a metronome in a process because it is always constant.
In Figure 3, you can see how the output of a random process is fed back into the input. In this example, you will get bangs that are randomly spaced at 50, 100, 150, and 200 milliseconds apart.