rfc:rng_fixes

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
Next revisionBoth sides next revision
rfc:rng_fixes [2016/06/14 14:50] leighrfc:rng_fixes [2016/06/16 18:48] leigh
Line 38: Line 38:
   * Platform-specific outputs   * Platform-specific outputs
   * Poor scaling of bounded outputs   * Poor scaling of bounded outputs
 +
 +This would also give a performance benefit to heavy users of the functions, as <php>mt_rand()</php> is very slow.
  
 == Fix mt_rand() implementation == == Fix mt_rand() implementation ==
 The implementation of <php>mt_rand()</php> in PHP contains a typo that makes it generate a different sequence of numbers to the original mt19937 implementation. [[https://bugs.php.net/bug.php?id=71152|See bug #71152]] The implementation of <php>mt_rand()</php> in PHP contains a typo that makes it generate a different sequence of numbers to the original mt19937 implementation. [[https://bugs.php.net/bug.php?id=71152|See bug #71152]]
  
-It is not known if the period or the quality of the output from the RNG is negatively affected due to this typo.+It is not known if the period of the RNG is negatively affected due to this typo, although statistical analysis suggests that the quality of the output is unaffected.
  
 As <php>mt_rand()</php> can be seeded for repeatable sequences the current implementation makes it incompatible with other systems that do use correct implementations. However fixing it also means that the sequence generated for a given seed in PHP will also now be different. As <php>mt_rand()</php> can be seeded for repeatable sequences the current implementation makes it incompatible with other systems that do use correct implementations. However fixing it also means that the sequence generated for a given seed in PHP will also now be different.
Line 64: Line 66:
  
 These instances should all be fixed to use the secure random number generator (even mcrypt which is deprecated) These instances should all be fixed to use the secure random number generator (even mcrypt which is deprecated)
 +
 +== Make array_rand() more efficient ==
 +It has been noted that ([[http://php.net/manual/en/function.array-rand.php#117114|array_rand() produces weird and very uneven random distribution]]). As the above proposals change the output of <php>array_rand()</php> anyway, we can fix this at the same time.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 96: Line 101:
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
-This will be an all or nothing vote (after discussion), and as the changes are functional, will require a 50%+1 majority to pass.+Individual votes will be held for the remaining proposals, and since minor BC breaks are introduced they will require a 2/3 majority to pass.
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/rng_fixes.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1