data rand
Cryptographically secure random numbers from the system generator (effect rand).
Example:
use std.crypto { rand }
fn main() io, rand {
print("{rand.secure(32).len()} {rand.token(4).len()}")
}Output
32 8
pub(api) data randThread safety. safe from any task; every call draws fresh bytes from the system generator.
Since. 1.0.0-beta
Methods
secure | (n: usize) -> bytes randn random bytes (n up to 16 MiB). |
token | (n: usize) -> str randA random token as lower-case hexadecimal text (2 * n characters). |
Defined in: std/crypto/crypto.oxl:270