php man page for rand

Query: rand

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

RAND(3) 								 1								   RAND(3)

rand - Generate a random integer

SYNOPSIS
int rand (void )
DESCRIPTION
int rand (int $min, int $max) If called without the optional $min, $max arguments rand(3) returns a pseudo-random integer between 0 and getrandmax(3). If you want a random number between 5 and 15 (inclusive), for example, use rand(5, 15). Caution This function does not generate cryptographically secure values, and should not be used for cryptographic purposes. If you need a cryptographically secure value, consider using random_int(3), random_bytes(3), or openssl_random_pseudo_bytes(3) instead. Note On some platforms (such as Windows), getrandmax(3) is only 32767. If you require a range larger than 32767, specifying $min and $max will allow you to create a range larger than this, or consider using mt_rand(3) instead.
PARAMETERS
o $min - The lowest value to return (default: 0) o $max - The highest value to return (default: getrandmax(3))
RETURN VALUES
A pseudo random value between $min (or 0) and $max (or getrandmax(3), inclusive).
EXAMPLES
Example #1 rand(3) example <?php echo rand() . " "; echo rand() . " "; echo rand(5, 15); ?> The above example will output something similar to: 7771 22264 11
SEE ALSO
srand(3), getrandmax(3), mt_rand(3), random_int(3), random_bytes(3), openssl_random_pseudo_bytes(3). PHP Documentation Group RAND(3)
Related Man Pages
srand(3) - centos
rand_r(3) - linux
rand(3) - debian
srand(3) - debian
srand(3) - suse
Similar Topics in the Unix Linux Community
awk to print mon and max values of ranges
Perl max and min issues
awk script to find min and max value
How to get min and max values using awk?
awk search for max and min while ignoring special character