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

decide Reference

Choose randomly between 1 and 0

decide

Description

Outputs random 1 and 0 messages. The output sequence depends on the seed value to determine the sequence of values.

Examples

Simulate a coin toss switch randomly between on and off

Arguments

seed [int]

Optional

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 for output.

Attributes

Common Box Attributes

Messages

bang

Causes a randomly chosen output of 1 or 0.

int

Arguments

input [int]
In left inlet: Same as bang.

  (inlet1)

Arguments

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.

Output

int

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.

See Also

Name Description
drunk
random
toggle
urn
Max Interface Tutorial 2: Picture UI Elements Max Interface Tutorial 2: Picture UI Elements