hanki

random

stdlib/extra/random.hk: random-number reads.

A pure-Hanki face over the sys native seam, like io/fs. Two primitives, a 64-bit draw and a byte buffer, with the [random] effect bubbling up through each delegating call. Any program that can mint randomness therefore says so in its signatures and can be refused wholesale with --deny random; pure code has no way to mint a nonce at all. Under --deterministic the stream is seeded from the run seed (reproducible, and never cryptographic); otherwise it draws from the OS CSPRNG. Range and float helpers are a later pure-Hanki surface.

No hermetic test block belongs here: this module has no logic of its own, each function being a thin effectful delegation to the sys native seam, and exercising it needs real, non-deterministic OS state that cannot be asserted in the pure stdlib test pack. Coverage is end-to-end through the CLI integration tests and example programs.

u64!

def u64!() -> u64 [random]

A uniform 64-bit random value. @no-doctest: draws fresh entropy; the result is non-deterministic

bytes!

def bytes!(n: i32) -> bytes [random]

n random bytes (negative n yields an empty buffer). @no-doctest: draws fresh entropy; the result is non-deterministic