-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 #17467 1st call to rand is now non-skewed; allow seed == 0 #17468
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timotheecour
force-pushed
the
pr_fix_trandom
branch
2 times, most recently
from
March 23, 2021 08:33
6cc35fd
to
ecf4454
Compare
konsumlamm
reviewed
Mar 23, 2021
timotheecour
changed the title
fix #17467 1st call to rand is now non-skewed
fix #17467 1st call to rand is now non-skewed; allow seed = 0
Mar 23, 2021
timotheecour
changed the title
fix #17467 1st call to rand is now non-skewed; allow seed = 0
fix #17467 1st call to rand is now non-skewed; allow seed == 0
Mar 23, 2021
timotheecour
force-pushed
the
pr_fix_trandom
branch
2 times, most recently
from
March 23, 2021 22:54
530d454
to
e2c6d04
Compare
ringabout
reviewed
Mar 24, 2021
What are the benefits of seed |
timotheecour
force-pushed
the
pr_fix_trandom
branch
from
May 3, 2021 21:52
2c08ff4
to
16ed873
Compare
timotheecour
force-pushed
the
pr_fix_trandom
branch
from
May 3, 2021 23:29
cbae73c
to
127133d
Compare
simpler API with less edge cases. |
timotheecour
added
the
Ready For Review
(please take another look): ready for next review round
label
May 4, 2021
PMunch
pushed a commit
to PMunch/Nim
that referenced
this pull request
Mar 28, 2022
nim-lang#17468) * fix nim-lang#17467 1st call to rand is now non-skewed; allow passing 0 as seed * changelog + fallback * document behavior for seed == 0 * address comments * _ * fix tests, disable kdtree * re-enable kdtree with -d:nimLegacyRandomInitRand
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix 1st call to
rand(1.0)
generates predictable values < 1e-4 for seeds in 0..<26844, unlike C++, python, D, ... #17467: 1st call to rand is now non-skewed; this avoids skewing distributionsuse
-d:nimLegacyRandomInitRand
for restoring previous behavior, for a transition timeallow passing arbitrary seed including 0
(EDIT) fixes
random
doesn't generate uniform numbers (very high correlation) when using seed from time #8589 (seerandom
doesn't generate uniform numbers (very high correlation) when using seed from time #8589 (comment))(EDIT) fixes First call to Rand.random(100) after a seeded initRand() is always 0 #18658