(Needed: Example Video)
(Needed: Overview Text)
(Needed: Fixture Patches with download)
Random numbers are used in games, gambling, statistical analysis, music, art, randomized design, A.I., computer simulation and even divination. The use of random numbers over the ages has seen the development of many techniques to develop a random output of numbers. Examples are dice, coin flipping, shuffling or playing cards, the use of yarrow sticks in I Ching and others.
The use of chance in the arts can be falls under different headings such as random, stochastic, aleatoric, probabilistic but they all sahre a common theme - events which result in non-deterministic outcomes some or all of the time.
During the 20th century the Western Art world started taking a more concerted look at the role of randomness in the arts. In music people like John Cage and Iannis Xenakis developed compositional techniques for random and probabilistic composition and performance, authors such as William Burrows experimented with cut-up techniques, Dadaist painters used various random techniques to create anti-art and later on Jackson Pollack used a mixed of intent and randomness in his Action Painting. In the contemporary arts world the use of randomness is seen as a general principle that can be employed at will. In the Digital Arts the use of different random techniques is often a fundamental requirement to producing specified goals.
In Max there are many ways to generate random numbers but there are a few objects dedicated to providing this function. Random, Drunk, Urn and Decide are four objects commonly used to generate a random stream of numbers or to make decisions randomly.
The Random object takes a maximum number as a argument. When the Random object is sent a Bang it will output a number between 0 and the maximum. For example when banged a random object with an argument of 100 will output a number between 0 and 99. An integer number box connected to the right inlet of the random object allows the user to set the maximum argument at a later time.
The random object only outputs integers or whole numbers so we need to further divide the output by a floating point number to get fractional numbers. For example to get a random value between 0. and 1. a typical practice would be to generate a random number with a maximum of 1000 and then divide the output by 1000.00 floating point. The result will now be a random number between 0. and 1. with 3 decimal places or ranging between 0.000 and 0.999.
A typical musical use of the random object is to randomly generate sequences of numbers between 0 and 127 which are then sent to the makenote object or the mtof object to generate pitched tones. Another typical use might be to randomly generate values for synthesis parameters.
When using the Random object every number between 0 and the set maximum has an equal probability of being generated. This means that it is possible for numbers to repeat. While this is truly random it is not always useful in an artistic setting. We may not mind what value is output, given a certain range, but we do want a different value not the same value repeated again.
To meet this requirement use the urn object. Urn can be thought of like names in a hats. After a name is randomly chosen it is also removed from the hat. This prevents the possibility of repeating the same value. When urn has exhausted all it's possibilities it needs to be reset - which is the digital equivalent of putting the names back in the hat.
It can happen that after urn has been reset the next number out of the newly reset urn can be the same as the last number from the last round of randomly generated numbers. To remove all possibility of ever having a value directly repeat use the urn-jb abstraction. Urn-jb solves this problem by shifting the new series by one, if necessary.
(Needed: text and links)
(Needed: text and exercises)