rfc:random_extension_improvement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:random_extension_improvement [2022/06/30 14:08] – improve array_rand() example + formatting/links guilliamxavierrfc:random_extension_improvement [2022/07/22 09:55] (current) – reword two issues as the problem (VS the proposed solution) guilliamxavier
Line 1: Line 1:
 ====== PHP RFC: Random Extension Improvement ====== ====== PHP RFC: Random Extension Improvement ======
-  * Version: 1.5.3+  * Version: 1.5.4
   * Date: 2022-06-16   * Date: 2022-06-16
   * Author: Go Kudo <g-kudo@colopl.co.jp> <zeriyoshi@gmail.com>   * Author: Go Kudo <g-kudo@colopl.co.jp> <zeriyoshi@gmail.com>
-  * Status: Under Discussion+  * Status: Implemented
   * First Published at: http://wiki.php.net/rfc/rng_extension   * First Published at: http://wiki.php.net/rfc/rng_extension
  
Line 36: Line 36:
 In order to preserve the implementation of the lcg_value() function, the internal implementation is retained, but the implementation as a class is being dropped to prevent users from unintentionally using it. In order to preserve the implementation of the lcg_value() function, the internal implementation is retained, but the implementation as a class is being dropped to prevent users from unintentionally using it.
  
-==== Add Randomizer::pickArrayKeys(array $array, int $num): array method ====+==== There is no equivalent of array_rand() ====
  
 <php>array_rand()</php> uses RNG internally, but there is no alternative method in ''Randomizer''. <php>array_rand()</php> uses RNG internally, but there is no alternative method in ''Randomizer''.
Line 67: Line 67:
 Therefore, it may be better to change the alternative method of str_shuffle(), ''Randomizer::shuffle**String**()'', to ''Randomizer::shuffle**Bytes**()''. This is a more appropriate name. Therefore, it may be better to change the alternative method of str_shuffle(), ''Randomizer::shuffle**String**()'', to ''Randomizer::shuffle**Bytes**()''. This is a more appropriate name.
  
-==== Refine classnames ====+==== Engine classnames are not precise ====
  
 To clearly identify the implemented algorithm, the PCG64 and MersenneTwister engines should be renamed to their canonical upstream name: To clearly identify the implemented algorithm, the PCG64 and MersenneTwister engines should be renamed to their canonical upstream name:
Line 106: Line 106:
 </doodle> </doodle>
  
-==== Add Randomizer::pickArrayKeys(array $array, int $num): array method ====+==== There is no equivalent of array_rand() ====
  
 <doodle title="Add the pickArrayKeys() method to the Randomizer?" auth="zeriyoshi" voteType="single" closed="true"> <doodle title="Add the pickArrayKeys() method to the Randomizer?" auth="zeriyoshi" voteType="single" closed="true">
Line 120: Line 120:
 </doodle> </doodle>
  
-==== Refine classnames ====+==== Engine classnames are not precise ====
  
 <doodle title="Rename PCG64 and MersenneTwister?" auth="zeriyoshi" voteType="single" closed="true"> <doodle title="Rename PCG64 and MersenneTwister?" auth="zeriyoshi" voteType="single" closed="true">
Line 169: Line 169:
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
-currently none+  * https://github.com/php/php-src/pull/8094
  
 ===== References ===== ===== References =====
  
   * https://externals.io/message/117939   * https://externals.io/message/117939
rfc/random_extension_improvement.1656598081.txt.gz · Last modified: 2022/06/30 14:08 by guilliamxavier