rng

Core Math

Set random number generator seed for reproducible results. Uses mulberry32 PRNG. Call rng("default") to restore non-deterministic mode.

Syntax

rng(seed)
rng("default")

Examples

rng(42); rand()
▶ Run
rng(42); randn(1, 5)
▶ Run

See Also

Try SimLab — Free MATLAB® Alternative

466 functions. Runs in your browser. No install.

Open SimLab

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.