sunfishcode opened PR #6596 from sunfishcode:sunfishcode/set-random to bytecodealliance:main:
Add a
set_randomfunction toWasiCtxBuilder, allowing users that construct a default interface viaWasiCtxBuilder::default()orWasiCtx::builder()to initialize therandomstate.Fixes #6576.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
sunfishcode requested itsrainy for a review on PR #6596.
sunfishcode requested wasmtime-core-reviewers for a review on PR #6596.
sunfishcode updated PR #6596.
alexcrichton created PR review comment:
I'm not sure of the underlying motivations for this, but I would naively expect this to be
set_randomand not#[cfg(test)]where the new method added in this PR would be something likeset_random_randomized(orset_random_systemor something like that). While the CLI likely doesn't wantset_random_for_testingI could see that being useful in a deterministic record-and-replay sort of scenario
sunfishcode updated PR #6596.
sunfishcode updated PR #6596.
pchickey submitted PR review.
sunfishcode updated PR #6596.
sunfishcode merged PR #6596.
Last updated: Dec 06 2025 at 06:05 UTC