Skip to content

random: Clean up seeding API #13540

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 9 commits into from
Feb 29, 2024
Merged

random: Clean up seeding API #13540

merged 9 commits into from
Feb 29, 2024

Conversation

TimWolla
Copy link
Member

As promised in #13350 (comment):

As a possible follow-up, I plan to remove the seed member from the struct php_random_algo and instead add well-typed engine specific seed functions, because seeding an engine generically does not appear super useful to me (Mt19937 ignores the upper half of the uint64_t seed for example).

This avoids the function pointer indirection and improves type safety.
Different engines work quite differently, it is not useful to attempt to seed
them in a generic way using a 64 bit integer. As an example Mt19937 completely
ignores the upper 32 bits.
See the explanation in the previous commit for the reasoning. This member is
unused since the previous commit and was not consistently available even before
that (specifically for the Secure engine).
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me.
The macOS failure and Linux NTS failure are unrelated to this PR.

@TimWolla TimWolla merged commit 99e7cf0 into php:master Feb 29, 2024
@TimWolla TimWolla deleted the random-seed-api branch May 23, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants