Re: [VOTE] Random Extension Improvement
| From: | Tim Düsterhus | Date: | Thu, 07 Jul 2022 16:43:56 +0000 |
| Subject: | Re: [VOTE] Random Extension Improvement | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118218@lists.php.net to get a copy of this message | ||
Hi
On 7/7/22 17:52, Go Kudo wrote:
Attachment: [text/x-csrc] pcg-verification.c
Attachment: [text/x-c++src] mt-verification.cc
Implementation is now proceeding.
It includes fixes to some of the issues that were pointed out previously.
https://github.com/php/php-src/pull/8094
Randomizer::arrayPickKeys() is currently not implemented for now, since
it is most likely to be rejected.
(Of course, we are ready to revert to the other items if they are also
rejected.)
I want to see if it looks good to you.
I've reviewed the current implementation of the engines with a specific focus on the tests.
1. I have verified the Xoshiro256** tests against a pure PHP implementation (which I verified against the C reference implementation [1]).
2. I have verified the Pcg64OneseqXslRr64 pcgoneseq128xslrr64_value.phpt test against the reference C implementation [2] with the attached pcg-verification.c.
3. I have verified the Mt19937 mt_value.phpt test against the C++ standard library implementation [3] with the attached mt-verification.cc.
The three engines do what they are supposed to do. I'm not qualified to review with regard to PHP Internals best practices. It would be good if someone with the necessary expertise could proceed with that part of the review.
Best regards
Tim Düsterhus
[1] https://prng.di.unimi.it/xoshiro256starstar.c
[2] https://www.pcg-random.org/download.html#c-implementation
[3] https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
Attachment: [text/x-csrc] pcg-verification.c
Attachment: [text/x-c++src] mt-verification.cc