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

Fix poor randomness properties of first call to `Rand.next()`. #2321

Merged
merged 1 commit into from Nov 16, 2017

Conversation

Projects
None yet
2 participants
@EpicEric
Contributor

EpicEric commented Nov 2, 2017

The current implementations of XorOshiro128Plus and XorShift128Plus return the sum of input seed values for the first value, which is unsafe. Rather than telling people to discard the first value, skip past it in the actual implementation.

This commit also fixes the documentation of current implementations for consistency with the Random trait.

Resolves #2320

@SeanTAllen SeanTAllen requested a review from sylvanc Nov 4, 2017

Eric Pires
Run next() for uninitialized Random values
The current implementations of XorOshiro128Plus and XorShift128Plus
return the sum of input seed values for the first value, which is
unsafe. Rather than telling people to discard the first value,
skip past it in the actual implementation.

This commit also fixes the documentation of current implementations
for consistency with the Random trait.

Resolves #2320

@jemc jemc changed the title from Run next() for uninitialized Random values to Fix poor randomness properties of first call to `Rand.next()`. Nov 16, 2017

@jemc jemc merged commit 0785ebd into ponylang:master Nov 16, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

ponylang-main added a commit that referenced this pull request Nov 16, 2017

@jemc

This comment has been minimized.

Show comment
Hide comment
@jemc

jemc Nov 16, 2017

Member

Thank you!

Member

jemc commented Nov 16, 2017

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment