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

Alternate rand, rand_r and srand implementation #32

Merged
merged 11 commits into from
Nov 22, 2024
Merged

Conversation

thejpster
Copy link
Member

Builds on #31 but removes the thread-safety (as the standard doesn't require it) and supports both 16-bit c_int and 32-bit c_int (with RAND_MAX always being c_int::MAX).

src/rand_r.rs Outdated Show resolved Hide resolved
@jonathanpallant
Copy link
Collaborator

Is this one good to go?

Sympatron and others added 11 commits November 22, 2024 14:16
Might be useful if your newlib assumes that, even with 32-bit integers.

Also adds "rand" to list of features in "all" and fixes missing portable-atomic.
It's not actually that useful.
This then matches the stdlib.h declaration.

Looking at the numbers generated, having that be a 16-bit value doesn't
appear to affect the quality of the output significantly. It's certainly
good enough for typical use cases.
@jonathanpallant jonathanpallant added this pull request to the merge queue Nov 22, 2024
Merged via the queue into main with commit 15665a5 Nov 22, 2024
14 checks passed
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.

4 participants