[wp-trac] [WordPress Trac] #15089: wp_rand() can be asked for negative numbers but will never return them

WordPress Trac noreply at wordpress.org
Tue Feb 8 00:08:34 UTC 2022


#15089: wp_rand() can be asked for negative numbers but will never return them
----------------------------+------------------------------
 Reporter:  hakre           |       Owner:  (none)
     Type:  defect (bug)    |      Status:  reopened
 Priority:  lowest          |   Milestone:  Awaiting Review
Component:  Inline Docs     |     Version:  2.6
 Severity:  trivial         |  Resolution:
 Keywords:  good-first-bug  |     Focuses:  docs
----------------------------+------------------------------
Changes (by jeremyfelt):

 * status:  closed => reopened
 * focuses:   => docs
 * version:  3.0 => 2.6
 * milestone:   => Awaiting Review
 * keywords:   => good-first-bug
 * resolution:  maybelater =>


Comment:

 It's a little confusing that `wp_rand()` will not return a negative
 integer. I think it would be worth adding a short note the function docs,
 especially now that it's mostly a wrapper of `random_int()`, which will
 return negative integers.

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


More information about the wp-trac mailing list