# 20Concepts Lesson 07 - More About Numbers

(Needed: Example Video)

(Needed: Overview Text)

## Random Numbers

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.

Compositions that could be considered a precedent for aleatory composition date back to at least the late 15th century, with the genre of the catholicon, exemplified by the Missa cuiusvis toni of Johannes Ockeghem. A later genre was the Musikalisches Würfelspiel or musical dice game, popular in the late 18th and early 19th century. The term aleatory music was first coined by Werner Meyer-Eppler in 1955 to describe a course of sound events that is "determined in general but depends on chance in detail". American composer John Cage's Music of Changes (1951) is often considered the first piece to be conceived largely through random procedure, although it differed in details from Werner Meyer-Epplers description. The modern use of random numbers in music has become a widespread and commonly practiced technique.

## Random

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 deals with integers so we need to further divide the output by a floating point number to get fractional numbers. To get a random value between 0. and 1. an typical tactic would be to generate a random number with a maximum of 1000 and then divide the output by 1000. 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.

(Needed: text)

(Needed: text)

(Needed: text)

• change
• clip
• rslider

(Needed: text)