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
Remove unused util::detail::rand64bit method #2232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering why this assertion was here in the first place, and believe it was probably added to ensure that both uint32_t
halves of the uint64_t
calculated here in below loop are distributed uniformly; if RAND_MAX
is less than the maximum uint32_t
this is not true anymore.
It looks like the value of RAND_MAX
is also used implicitly here which then also causes prng
and random_number
to return values <=RAND_MAX
.
Another issue is that differing RAND_MAX
values would not make prng
and its users platform-independent anymore like advertised.
TBH, I think this might need a better fix which requires more thinking. You might still want to merge this to unblock CI.
EDIT
Looks like FreeBSD changes the value of RAND_MAX
to fix uniformity issues with rand
. Arguing that system rand
is often of poor quality usually anyway you might able to get away by just removing the static_assert
here.
Looks reasonable for now - but yes, we should probably fix this differently :/ |
Thinking about it - this function is in I move to just delete it completely. |
cf95220
to
8ed9543
Compare
Sounds good me. I pushed a commit that does that. |
8ed9543
to
ecc1cb0
Compare
@ckreibich confirmed this method isn't used by any packages in the package repo, so I'll go ahead and push this. |
ecc1cb0
to
ef659b8
Compare
No description provided.