drunk Reference

Output random numbers within a step range

drunk

Description

Performs a "drunken" walk by outputting random numbers within a specified step range.

Examples

Numbers vary aimlessly in small steps taken within the total range

Arguments

maximum value [int]

Optional

Sets the maximum number produced. If this argument is not provided, the maximum value is set to 128.

step size [int]

Optional

Sets an initial limit on the size of random steps taken; the absolute value of the step size will always be less than the absolute value of this limit. If a negative value is specified as a step size, steps of size zero are never generated. If this argument is not provided, the step size is set to 2 (movement up or down by no more than 1).

Attributes

Common Box Attributes

Messages

bang

Causes drunk to take a step of random size up or down from its currently stored value. It updates the stored value and outputs it.

int

Arguments

input [int]
The number replaces the stored value and is sent out the outlet.

  (inlet1)

Arguments

maximum [int]
In middle inlet: The number is stored as the maximum value that can be output by drunk. If the specified maximum is less than 0 it is set to 0.

  (inlet2)

Arguments

step-size [int]
In right inlet: The number limits the step size taken in response to a bang in the left inlet. The step (up or down) will always be less than the absolute value of this number.

float

Arguments

input [float]
Converted to int.

seed

Arguments

random-seed [int]
Seeds the object's random generator, which causes a specific (reproducible) sequence of pseudo-random numbers to occur. The number 0 uses the time elapsed since system startup (an unpredictable value) as the seed, ensuring an unpredictable sequence of numbers.

set

Arguments

input [int]
The word set, followed by a number, sets the stored value to that number without triggering output. The stored value is initially set in the center of the total range (1/2 the maximum value).

Output

int

The number sent out the outlet is automatically limited between 0 and the specified maximum value, and differs from the previously stored number by less than the maximum step size.

See Also

Name Description
decide
random
urn
Max Basic Tutorial 10: Random Drawing Max Basic Tutorial 10: Random Drawing