-
Notifications
You must be signed in to change notification settings - Fork 7.8k
[RFC] Random Extension 5.x + Random Extension Improvement #8094
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
Conversation
7c67e8b
to
8f9f004
Compare
I've found one more issue: Serialization of MersenneTwister is not correct: <?php
use Random\Engine\MersenneTwister;
$g1 = new MersenneTwister(1, MT_RAND_PHP);
$g2 = unserialize(serialize($g1));
for ($i = 0; $i < 10000; $i++) {
if ($g1->generate() !== $g2->generate()) {
var_dump($i);
exit;
}
}
echo "Success"; |
fixed: 007b02c |
78e7da0
to
9e1f715
Compare
ca32959
to
d565273
Compare
af9c3ec
to
34f20ea
Compare
aedf064
to
d983a0b
Compare
8f4220e
to
a470b7b
Compare
@TimWolla Sorry for the delay in responding. Thank you! |
fecf74b
to
465e081
Compare
Indeed, it should. |
Don't spend too much time thinking about that. The info in that file is rather informal. Just add yourself as primary maintainer, and also @TimWolla if he wants that. That also doesn't mean that you are responsible for the extension; it's more like a hint that you may be the best person to reach out if there are any issues with that extension. |
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.
Looks good to me for what it's worth.
@zeriyoshi Could you squash it please? |
@zeriyoshi @cmb69 Sure, feel free to list me as a co-maintainer (use either [email protected] or [email protected]). Significant parts of the design of the extension are based on my suggestions and I'll be happy at the very least to review future evaluations of the extension. |
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.
A couple nits
@zeriyoshi Just a reminder that the feature is in 24 hours and something so it would be good get it merged soon. Is there anything else that you want to do before merging? As I noted, the squashing that to a single commit or couple standalone commits if you prefer would be appreciated. I can handle the merging if no one else wants to do that. |
@bukka |
33679c6
to
2e6b742
Compare
@bukka @TimWolla @cmb69 @bwoebi @kocsismate @guilliamxavier All commits are combined into one. However, some records of the parts that were suggestion have been lost along the way. However, I think this is not a problem because we can refer to it on the pull request. What do you think? Also, I have worked around the Assertion Failed problem on Windows by adding a workaround. This is already a separate issue and should be addressed separately. As far as I can see, this PR is already ready to merge. What do you think? I will create a follow-up MR as soon as this is merged to fix the issues mentioned in the PR and ML. |
P.S. Branches before being squashed can be found at: https://github.com/colopl/php-src/tree/upstream_rfc/scoped_rng_backup |
CI passed 😎 |
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.
Tests are unmodified and I eyeballed the newest changes, this still LGTM and IMO is ready to merge.
@bukka Will you handle the merge, please? 😃 |
This has been merged via 4d8dd8d - just moved some bits from NEWS to UPGRADING otherwise it was perfectly ready. Thanks! Great work! |
END_EXTERN_C() | ||
|
||
#endif | ||
#include "ext/random/php_random.h" |
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.
Sorry I just noticed: here was introduced a Git warning "No newline at end of file"
RFC: https://wiki.php.net/rfc/rng_extension
Additional RFC: https://wiki.php.net/rfc/random_extension_improvement
Internals Threads:
TODO
pcg_setseq_128
->pcg_oneseq_128
) PoC is doneRandom\Engine\MersenneTwister
withMT_RAND_PHP
flagsRandom\Randomizer::pickArrayKeys(array $array, int $num): array
Random\Randomizer::shuffleString()
toRandom\Randomizer::shuffleBytes()
Random\Engine\PCG64
toRandom\Engine\Pcg64OneseqXslRr64
Random\Engine\MersenneTwister
toRandom\Engine\Mt19937
Random\Engine\Xoshiro256StarStar
master