MCPcopy Index your code
hub / github.com/RustPython/RustPython / os_random

Function os_random

crates/common/src/rand.rs:9–13  ·  view source on GitHub ↗

Get `N` bytes of random data. This function is mildly expensive to call, as it fetches random data directly from the OS entropy source. # Panics Panics if the OS entropy source returns an error.

()

Source from the content-addressed store, hash-verified

7///
8/// Panics if the OS entropy source returns an error.
9pub fn os_random<const N: usize>() -> [u8; N] {
10 let mut buf = [0u8; N];
11 getrandom::fill(&mut buf).unwrap();
12 buf
13}

Callers 1

process_hash_secret_seedFunction · 0.85

Calls 2

fillFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected