[wp-trac] [WordPress Trac] #55194: wp_rand( 0, 0) result in random integer
WordPress Trac
noreply at wordpress.org
Fri Feb 18 21:58:09 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: has-patch | Focuses: docs
--------------------------+---------------------
Comment (by mlajo):
Replying to [comment:9 SergeyBiryukov]:
> Just out of curiousity, what would be the use case for a `wp_rand( 0, 0
)` call?
something as @azouamauriac said, we have code with wp_rand( 0, $var )
where $var can sometimes be 0. Now we added one "if check" before to
check if $var is 0 but it was confusing to debug because mt_rand() worked
as expected.
If it stays like this it would be nice to put some kind of notice for that
case in documentation.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55194#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list