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

Function deterministic

crates/wasi-common/src/random.rs:43–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 use super::*;
42 #[test]
43 fn deterministic() {
44 let mut det = Deterministic::new(vec![1, 2, 3, 4]);
45 let mut buf = vec![0; 1024];
46 det.try_fill_bytes(&mut buf).expect("get randomness");
47 for (ix, b) in buf.iter().enumerate() {
48 assert_eq!(*b, (ix % 4) as u8 + 1)
49 }
50 }
51}

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