Skip to content

Remove Preview1's advice about random-number generators. #664

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sunfishcode
Copy link
Member

Previously, the preview1 documentation for the random_get function said:

This function may execute slowly, so when large mounts of random data are
required, it's advisable to use this function to seed a pseudo-random
number generator, rather than to provide the random data directly.

However, Wasm guest code is unaware of VM forks in any VMs might be running in, as well as snapshot/resume features offered by some Wasm engines and tools, so in practice, WASI use cases have tended toward using random_get in place of guest PRNGs, and thus to relying on random_get executing quickly.

This pattern seems sufficiently widely applicable to motivate updating WASIp1 to reflect it. To be sure, this is not a behavior change; it's just removing what we now understand to be bad advice in general.

WASIp2 for its part has already made a similar change.

Previously, the preview1 documentation for the `random_get` function said:

> This function may execute slowly, so when large mounts of random data are
> required, it's advisable to use this function to seed a pseudo-random
> number generator, rather than to provide the random data directly.

However, Wasm guest code is unaware of VM forks in any VMs might be running
in, as well as snapshot/resume features offered by some Wasm engines and
tools, so in practice, WASI use cases have tended toward using `random_get`
in place of guest PRNGs, and thus to relying on `random_get` executing
quickly.

This pattern seems sufficiently widely applicable to motivate updating
WASIp1 to reflect it. To be sure, this is not a behavior change; it's just
removing what we now understand to be bad advice in general.

WASIp2 for its part has already made a similar change.
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