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

random Reference

Generate random numbers

random

Examples

Arguments

limit [number]

Optional

Sets an initial upper limit to the random number generation. The output will always be between 0 and this maximum limit. If there is no argument, the limit is set to 1.

Inlets

trigger [bang]

A bang in the left inlet will generate a random number out the outlet.

limit [number]

Sets an initial upper limit to the random number generation. The output will always be between 0 and this maximum limit. If there is no argument, the limit is set to 1.

Outlets

result [number]

When a bang is received in the left inlet, random generates a random number between 0 and its maximum limit and sends that number out the outlet.

Dynamic Attributes

These attributes can be modified in the code during execution using the set object

limit [number]

Sets an initial upper limit to the random number generation. The output will always be between 0 and this maximum limit. If there is no argument, the limit is set to 1.

seed [number]

The @seed attribute is used to set a "seed" value for the random generator for predictable results. If no argument is specified, the time value will be used to initialize the seed.

trigger [bang]

A bang in the left inlet will generate a random number out the outlet.

See Also

Name Description
drunk Output random numbers within a step range.
urn Generate random numbers without duplicates