Expand description
The operating system’s random number generator.
fill and fill_uninit write bytes from the system’s
cryptographically secure generator: unpredictable, and suitable for keys.
| System | Source |
|---|---|
| Linux | getrandom |
| macOS | getentropy, 256 bytes at a time |
| Windows | ProcessPrng (bcryptprimitives.dll) |
| WASI | random_get |
Each call reaches the system: nothing is buffered in the process. A program that wants many small random values should seed its own generator from one call.
Functions§
- fill
- Fills
bufwith random bytes. - fill_
uninit - Fills
bufwith random bytes, and returns it as initialised.