MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / deterministic

Function deterministic

crates/wasi/src/random.rs:125–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

123 use super::*;
124 #[test]
125 fn deterministic() {
126 let mut det = Deterministic::new(vec![1, 2, 3, 4]);
127 let mut buf = vec![0; 1024];
128 det.try_fill_bytes(&mut buf).expect("get randomness");
129 for (ix, b) in buf.iter().enumerate() {
130 assert_eq!(*b, (ix % 4) as u8 + 1)
131 }
132 }
133}
134
135pub fn thread_rng() -> Box<dyn Rng + Send> {

Callers

nothing calls this directly

Calls 4

newFunction · 0.50
expectMethod · 0.45
try_fill_bytesMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected