[DOC-CVS] [doc-en] master: Fix rand() range constraint to use abs() for reversed parameters (#5264)
[email protected] (Louis-Arnaud via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-02-06T13:56:19Z
Commit: https://github.com/php/doc-en/commit/a2a3f3525979535f7f8c81b79315391f2fdc285b
Raw diff: https://github.com/php/doc-en/commit/a2a3f3525979535f7f8c81b79315391f2fdc285b.diff
Fix rand() range constraint to use abs() for reversed parameters (#5264)
Changed paths:
M reference/random/functions/rand.xml
Diff:
diff --git a/reference/random/functions/rand.xml b/reference/random/functions/rand.xml
index 9009f221f478..ec55b6bb2f1f 100644
--- a/reference/random/functions/rand.xml
+++ b/reference/random/functions/rand.xml
@@ -132,8 +132,9 @@ echo rand(5, 15), "\n";
<warning>
<para>
<parameter>min</parameter> <parameter>max</parameter> range must
- be within the range <function>getrandmax</function>. i.e. (<parameter>max</parameter> -
- <parameter>min</parameter>) <= <function>getrandmax</function>
+ be within the range <function>getrandmax</function>. i.e.
+ abs(<parameter>max</parameter> - <parameter>min</parameter>) <=
+ <function>getrandmax</function>.
Otherwise, <function>rand</function> may return poor-quality random numbers.
</para>
</warning>