Skip to content

Add RandomBufferGenerator protocol for WASI random_get #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Apr 26, 2024

This protocol allows to inject a custom random number generator for wasi_snapshot_preview1::random_get function. The default implementation continues to use swift_stdlib_random function but users can provide their own implementation. Additionally, types conforming to RandomNumberGenerator can automatically conform to the new protocol.

This is useful when we want fully deterministic behavior like build tools or tests.

Resolves a part of #84

This protocol allows to inject a custom random number generator for
`wasi_snapshot_preview1::random_get` function. The default implementation
continues to use `swift_stdlib_random` function but users can provide
their own implementation. Additionally, types conforming to
`RandomNumberGenerator` can automatically conform to the new protocol.

This is useful when we want fully deterministic behavior like build
tools or tests.
@kateinoigakukun kateinoigakukun merged commit 949ff74 into main Apr 26, 2024
6 checks passed
@kateinoigakukun kateinoigakukun deleted the katei/buffer-generator-protocol branch April 26, 2024 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant