Skip to content
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

[SR-11459] Improve documentation for requirements of RandomNumberGenerator #53860

Open
stephentyrone opened this issue Sep 12, 2019 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. documentation standard library Area: Standard library umbrella

Comments

@stephentyrone
Copy link
Member

Previous ID SR-11459
Radar None
Original Reporter @stephentyrone
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, Documentation
Assignee None
Priority Medium

md5: 0d16f7f5ecdd5bcd2daff9d2024c6935

Issue Description:

The documentation currently states:

To make a custom type conform to the RandomNumberGenerator protocol, implement the required next() method. Each call to next() must produce a uniform and independent random value.

This is completely correct and fully specifies the behavior, but we should probably be a little bit more clear that in order to function correctly, it must generate all possible `UInt64` values (or equivalently that each bit is uniformly 0 or 1). Ideally we should give some examples of things that are not acceptable implementations (e.g. calling `rand()` or `lrand48()` and converting the result to `UInt64`).

Spun off from SR-11447

@stephentyrone
Copy link
Member Author

CC @natecook1000

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. documentation standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant