summaryrefslogtreecommitdiff
path: root/pod/perlfunc.pod
diff options
context:
space:
mode:
authorWalt Mankowski <waltman@pobox.com>2001-04-29 17:53:48 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-30 10:56:08 +0000
commit6063ba187760a62f10a97ba9dd6ff5a93107bb51 (patch)
treecae4c4a841e2f6405e4a0a60ebb81e23115d177b /pod/perlfunc.pod
parent35dcc76e92e9d0d2ee72780d700d8645acd7cae8 (diff)
downloadperl-6063ba187760a62f10a97ba9dd6ff5a93107bb51.tar.gz
[DOC PATCH bleadperl] Document generation of random integers
Message-ID: <20010429215348.A3971@netaxs.com> p4raw-id: //depot/perl@9909
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r--pod/perlfunc.pod7
1 files changed, 7 insertions, 0 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 4e7f1a940e..b97c4a896e 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -3509,6 +3509,13 @@ than the value of EXPR. (EXPR should be positive.) If EXPR is
omitted, the value C<1> is used. Automatically calls C<srand> unless
C<srand> has already been called. See also C<srand>.
+Apply C<int()> to the value returned by C<rand()> if you want random
+integers instead of random fractional numbers. For example,
+
+ int(rand(10))
+
+returns a random integer between C<0> and C<9>, inclusive.
+
(Note: If your rand function consistently returns numbers that are too
large or too small, then your version of Perl was probably compiled
with the wrong number of RANDBITS.)