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 integerSYNOPSISint rand (void )DESCRIPTIONint 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.PARAMETERSo $min - The lowest value to return (default: 0) o $max - The highest value to return (default: getrandmax(3))RETURN VALUESA pseudo random value between $min (or 0) and $max (or getrandmax(3), inclusive).EXAMPLESExample #1 rand(3) example <?php echo rand() . " "; echo rand() . " "; echo rand(5, 15); ?> The above example will output something similar to: 7771 22264 11SEE ALSOsrand(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 |
---|
rand(3) - debian |
rand(3) - suse |
rand_r(3) - suse |
srand(3) - suse |
mt_rand(3) - php |
Similar Topics in the Unix Linux Community |
---|
Awk search for max and min field values |
Perl max and min issues |
Extracting sub-string matching the pattern. |
awk script to find min and max value |
How to get min and max values using awk? |