[wp-trac] [WordPress Trac] #55194: wp_rand( 0, 0) result in random integer

WordPress Trac noreply at wordpress.org
Fri Feb 18 16:38:25 UTC 2022


#55194: wp_rand( 0, 0)  result in random integer
--------------------------+---------------------
 Reporter:  mlajo         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.0
Component:  General       |     Version:  5.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  docs
--------------------------+---------------------

Comment (by mlajo):

 This is not consistent with mt_rand and contra intuitive. It caused lots
 of trouble in our code until we pinpoint it to this function. Also coding
 standard https://github.com/WordPress/WordPress-Coding-
 Standards/blob/develop/WordPress/Sniffs/WP/AlternativeFunctionsSniff.php
 recommend to use it.
 mt_rand() is discouraged. Use the far less predictable wp_rand() instead.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55194#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list