Skip to content

Minor fixes for random float generation #11641

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 2 commits into from
May 13, 2022

Conversation

erikarvstedt
Copy link
Contributor

@erikarvstedt erikarvstedt commented May 12, 2022

Fixes some minor issues that were recently merged in #10428 (Improve stdlib's random float generation).

Copy of main commit msg

  • Test: Fix bucket counting. Previously, the first hit was not counted.
    This off-by-one error slightly increased the mean of *_total_variance, which decreased the acceptance rate for a particular random seed from 95% to 92.6%. (Irrelevant for test failure because the seed is fixed.)
  • Improve comments

cc @mrakh, @daurnimator, @andrewrk

- Test: Fix bucket counting. Previously, the first hit was not counted.
  This off-by-one error slightly increased the mean of `*_total_variance`,
  which decreased the acceptance rate for a particular random seed
  from 95% to 92.6%. (Irrelevant for test failure because the seed is fixed.)
- Improve comments
@erikarvstedt erikarvstedt force-pushed the fixup_rand_float_improvement branch from 402c85a to a3c433f Compare May 12, 2022 14:15
This saves a `bitwise or` operation in the common case and
removes the (slightly magic) mask constants.
@erikarvstedt erikarvstedt force-pushed the fixup_rand_float_improvement branch from a3c433f to 23ef7a8 Compare May 12, 2022 14:23
@andrewrk andrewrk merged commit f32928c into ziglang:master May 13, 2022
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.

2 participants