Re: [RFC] [Draft] Add Randomizer class (before: Add RNG extension)

From: Date: Tue, 25 May 2021 15:35:48 +0000
Subject: Re: [RFC] [Draft] Add Randomizer class (before: Add RNG extension)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-114594@lists.php.net to get a copy of this message
Hi, Thanks for the response. The RFC has been revised based on the points you pointed out. https://wiki.php.net/rfc/rng_extension The main changes are as follows: - Class name has been changed from Randomizer to Random . - Added a static method getNonBiasedMax() to get the safe range. - int() and bytes() have been renamed to getInt() and getBytes() for avoid future reserved words. - getInt() arguments no longer accept null. - shuffle(array|string $target): array|string has been separated into arrayShuffle(array $array) and stringShuffle(string $string): string for more comfortable static-analysis. - fix: php_random_algo struct (included uint64_t -> int64_t) Answer a few questions: > When $seed is null, what is used for the seed value? Depends on the algo's implementation, but basically it is using internal php_random_int(). It is similar to mt_srand() on PHP 8.1. https://github.com/php/php-src/commit/53ee3f7f897f7ee33a4c45210014648043386e13 > Why cancelled RNG Extension? As a result of discussions during the draft, the functions became a single class and no longer need to be separated. The functionality for random numbers is now included in ext/standard and will conform to this. (e.g. rand.c random.c) > Deprecation Dropped in the last RFC update. These were premature and should not have been included with the RFCs that add new features. If the direction seems generally okay, I'd like to start implementing it to show more details. Regards, Go Kudo 2021年5月23日(日) 5:56 Go Kudo <zeriyoshi@gmail..com>: > Hi, Internals and all participated in the previous discussion. > > RFCs have been cleaned up and the proposal has been substantially changed.. > > https://wiki.php.net/rfc/rng_extension > > First of all, I apologize for not checking out the implementation of > password_hash(), which is a precedent to learn from. > > I think I've answered all the questions I've been getting on Open Issues. > If I have left anything out, please let me know. > > Regards, > Go Kudo >

« previous php.internals (#114594) next »