baml.random.SystemRandom

A cryptographically secure generator backed by the operating system's entropy source (a CSPRNG). Draws fresh entropy on every call and is not seedable, so it is non-deterministic and suitable for security-sensitive randomness such as keys, tokens, and nonces.

Reference version

Signature

class baml.random.SystemRandom

A cryptographically secure generator backed by the operating system's entropy source (a CSPRNG). Draws fresh entropy on every call and is not seedable, so it is non-deterministic and suitable for security-sensitive randomness such as keys, tokens, and nonces.

Source:<builtin>/baml/ns_random/random.bamlbytes 1926–2358

Static methods

function

get

() -> baml.random.SystemRandom throws never

Returns a new SystemRandom instance using the global system random number generator.

Implementations

baml.Concrete for T

Source:<builtin>/baml/core.bamlbytes 763–795

baml.random.Rng for baml.random.SystemRandom

Instance methods

function

random

(self, bytes: int) -> uint8array throws never
function

random_int

(self) -> int throws never

Source:<builtin>/baml/ns_random/random.bamlbytes 2127–2356