Sha256: 7c57a068c9f34d8d5a0ed6f4e4b5f31ab70af97bfe2193a326a7251c6dd4c281
Contents?: true
Size: 1018 Bytes
Versions: 16
Compression:
Stored size: 1018 Bytes
Contents
use rand_core::SeedableRng; use rand_pcg::Pcg64Mcg; use wasi_common::WasiCtx; mod clocks; mod noop_scheduler; use noop_scheduler::NoopScheduler; pub fn build_wasi_ctx() -> WasiCtx { // Using Pcg64Mcg because it balances memory usage, performance, is adequately random, does not have major issues, // and has reproducible results across different platforms. SmallRng and StdRng were considered but are documented // as deterministic but not reproducible. // See https://rust-random.github.io/book/guide-rngs.html#basic-pseudo-random-number-generators-prngs // and https://docs.rs/rand_pcg/latest/rand_pcg/struct.Mcg128Xsl64.html for further details. const RANDOM_SEED: u64 = 42; // the answer to life, the universe, and everything let random = Box::new(Pcg64Mcg::seed_from_u64(RANDOM_SEED)); let clocks = clocks::new_clocks(); let scheduler = Box::new(NoopScheduler::new()); let table = wasi_common::table::Table::new(); WasiCtx::new(random, clocks, scheduler, table) }
Version data entries
16 entries across 16 versions & 1 rubygems