Zettelkasten/Permanent Notes/20260114153529-random-number-generation.md
2026-02-06 20:19:24 -05:00

40 lines
1.2 KiB
Markdown

---
id: 20260114153529
title: Random Number Generation
type: permanent
created: 2026-01-14T20:35:29Z
modified: 2026-01-14T20:46:35Z
tags: []
---
# Random Number Generation (RNG)
Random number generation is all about getting random
numbers, and is easily defined as picking a number from a
uniform distribution. Generally, there's two types:
## True RNG
True RNG is systems that are truly random. Random systems
are almost always derived from [[chaotic systems]], which
technically are deterministic, but as so final state
sensitive they're basically intractable and 'random' values
can be extracted. Sometimes lava lamps (turbulence) is used,
sometimes isotope decay is the thing.
## Pseudo RNG
Computers can't really do true RNG. They just can't handle
non-deterministic outcomes. In addition, true RNG is *slow*.
As such computers build PRNG.
>[!definition] Pseudo Random Number Generator
>
> $\text{Struct}(S, \mu, f, U, g)$
>
> Where:
> - $S$ is a finite set of states
> - $\mu$ is a distribution on S for the initial state (seed!)
> - $f:S \rightarrow S$, the state transition function
> - $U$ is the output space [0,1), or perhaps {0,...,m-1}
> - $g:S \rightarrow U$, the output function
>