# Random Source (`random`)

> A seeded random signal: a new uniform or Gaussian value every 1/fs seconds, held in between.

![random](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/random.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/random/)

**Group:** Control · **Kind:** `{"block":"random","kind":"control"}`

## When to use it

Use it for sensor noise, a disturbance on a reference or a random load, wherever the same random sequence must come back in every run. For noise on a meter's output, the meter's own noise parameter is simpler.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `out` | signal | offset plus the value drawn for the present interval |

## Common parameters

- `dist`: Distribution: `uniform` (offset plus a value from −amp to amp) or `gaussian` (offset plus a value of standard deviation amp) (Default: uniform)
- `amp`: Half the span of a uniform value, or the standard deviation of a Gaussian one (Default: 1)
- `fs`: How often a new value is drawn; the output holds in between (Default: required)
- `offset`: Fixed amount added to every drawn value (Default: 0)
- `seed`: Number that picks the sequence; the same seed gives the same run (Default: 1)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `dist` | — | uniform |  | Distribution: `uniform` (offset plus a value from −amp to amp) or `gaussian` (offset plus a value of standard deviation amp) |
| `amp` | — | 1 |  | Half the span of a uniform value, or the standard deviation of a Gaussian one |
| `offset` | — | 0 |  | Fixed amount added to every drawn value |
| `fs` | Hz | required |  | How often a new value is drawn; the output holds in between |
| `seed` | — | 1 |  | Number that picks the sequence; the same seed gives the same run |

_Parameter descriptions are in English in both languages._

## Model

Time is cut into intervals of 1/fs seconds starting at t = 0, and interval k holds one value: offset + amp·(2u − 1) with u uniform from 0 to 1 for dist = uniform, or offset + amp·z with z standard normal (Box–Muller) for dist = gaussian. The value is a pure function of seed and k (SplitMix64), so the same seed gives the same sequence in every run, in both solvers and after a restart, and a rejected step cannot change it. Each new interval is an event, so the solver lands on it.

## Common mistakes

- Every interval is a step the solver must land on, so a high fs over a long run costs many steps. Draw only as fast as the bandwidth you study needs.
- A Gaussian value has no bound: about one value in 370 lies beyond 3·amp. Put a Limiter after it when what it drives has a range.

## Datasheet and sources

There is no datasheet. For a sensor, amp is the noise the data sheet states (as an rms value with dist = gaussian) and fs is about twice its bandwidth.

## Example

Open the example with the command `file.openExample` and the name `demo:random`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
