A newer version of Max is available. Click here to access the latest version of this document.

decide

Choose randomly between on and off (1 and 0)

Description

decide outputs either a specific (reproducible) sequence of pseudo-random 1 s and 0 s or an unpredictable sequence of 0 s and 1 s depending on what "seed"-value is given.

Arguments

Name Type Opt Description
seed int opt Sets a "seed" value to cause a specific (reproducible) sequence of pseudo-random 0 and 1 outputs to occur. If there is no argument, the time elapsed since system startup (an unpredictable value) is used as the seed, ensuring an unpredictable sequence of 0 and 1 outputs.

Messages

bang In left inlet: Causes a randomly chosen output of 1 or 0.
int start [int]
In left inlet: Same as bang.
  (inlet1) seed [int]
In right inlet: A given "seed" number causes a specific (reproducible) sequence of pseudo-random 0 and 1 outputs to occur. The number 0 uses the time elapsed since system startup (an unpredictable value) as the seed, ensuring an unpredictable sequence of 0 and 1 outputs.

Information for box attributes common to all objects

Output

int: A 1 or a 0, chosen at random. With certain seed values, the output may seem at first to follow a "non-random" pattern, but over the course of many iterations the sequence becomes unpredictable and the balance between 1 and 0 becomes even.

Examples

Simulate a coin toss switch randomly between on and off

See Also

Name Description
drunk Output random numbers in a moving range
random Generate a random number
toggle Switch between off and on (0 and 1)
urn Generate random numbers without duplicates
Max Interface Tutorial 2: Picture UI Elements Max Interface Tutorial 2: Picture UI Elements