# Random

> Make a random number, integer, boolean, string, colour or choice on each trigger; seeded when a seed is wired.

Source: https://docs.tune.toys/nodes/data.random/

Random makes a new value each time its `trigger` input fires: a number, a whole number, true or false, a string, a colour or one of your own choices.

## What it does

Type chooses the datatype on `value`. Number and Integer fall between Minimum and Maximum, Boolean is true or false, String is Length characters from the node's alphabet, Colour is `#rrggbb` text and Choice picks one of the node's listed strings.

Without a `seed` cable each draw is unpredictable. With a seed cabled in, the sequence is a function of the seed and the draw count, so the same seed gives the same values every time the Toy starts.

During [replay](https://docs.tune.toys/concepts/takes/) Random does not draw again: the values it sent while the take was recorded are played back.

## When to use it

Use it with [Cron](https://docs.tune.toys/nodes/time.cron/) for generative patterns, to colour an `led` lamp, or, through [Data to control](https://docs.tune.toys/nodes/data.to-control/), to move a parameter by chance.

## Ports

<!-- ports:start -->

| Port      | Direction | Signal         | Lanes |
| --------- | --------- | -------------- | ----- |
| `trigger` | Input     | Data (trigger) | 1     |
| `seed`    | Input     | Data (integer) | 1     |
| `value`   | Output    | Data (any)     | 1     |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter      | Label        | Range               | Default | Unit | Scale  | Notes                                                                                                                                 |
| -------------- | ------------ | ------------------- | ------- | ---- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| `type`         | Type         | 0 to 5              | 0       |      | linear | Datatype of the value; Choice picks one of the listed strings. Choices: 0 Number, 1 Integer, 2 Boolean, 3 String, 4 Colour, 5 Choice. |
| `min`          | Minimum      | -1000000 to 1000000 | 0       |      | linear | Smallest number or integer.                                                                                                           |
| `max`          | Maximum      | -1000000 to 1000000 | 1       |      | linear | Largest number or integer.                                                                                                            |
| `length`       | Length       | 1 to 64             | 8       |      | linear | Characters in a random string.                                                                                                        |
| `distribution` | Distribution | 0 to 1              | 0       |      | linear | Uniform spreads values evenly; Normal clusters them around the middle of the range. Choices: 0 Uniform, 1 Normal.                     |

<!-- parameters:end -->

<!-- data:start -->

- `alphabet`: text.
- `choices`: strings.

<!-- data:end -->

### Type (`type`)

Number, Integer, Boolean, String, Colour or Choice. The `value` port takes this datatype, so a cable from it must fit: a colour feeds a lamp, a number feeds Data to control.

### Minimum (`min`) and Maximum (`max`)

The range for Number and Integer, from -1 000 000 to 1 000 000.

### Length (`length`)

Characters in a String, 1 to 64, drawn from the node's `alphabet` text field (letters and digits when empty).

### Distribution (`distribution`)

Uniform spreads values evenly across the range. Normal clusters them around the middle, which makes a random walk feel calmer.

### Choices and alphabet

The `choices` field lists up to 64 strings for Choice; the `alphabet` field sets the characters for String. Both are edited in the inspector.

## Tips

- Set Minimum and Maximum equal to send a constant number on every trigger.
- Wire a [Value](https://docs.tune.toys/nodes/data.value/) through [Convert](https://docs.tune.toys/nodes/data.convert/) into `seed` for repeatable patterns.

## See also

[Cron](https://docs.tune.toys/nodes/time.cron/), [Data to control](https://docs.tune.toys/nodes/data.to-control/), [Merge](https://docs.tune.toys/nodes/data.merge/), [Data cables](https://docs.tune.toys/concepts/data-cables/).
