User Tools

Site Tools


uphp:functions:rand

rand

WMPRO, WMMINI FW >= 1.893 WMMEGA FW >= 2.0

Return a random integer between min and max

Description

int rand ( int $min, int $max )

This function returns a pseudo-random whole number that is greater than or equal to min and less than max

Parameters

$min: Minimum possible value

$max: Maximum, returned values will be less than this

Return Values

Pseudo-random integer

Example

Generate 5 random numbers between 0 and 99

<pre><?
  for ($i=1; $i<=5; $i++) {
    print(rand(0,100)."\r\n");
  }
?></pre>

Typical output for the above example (actual results vary randomly):

76
44
12
49
84
uphp/functions/rand.txt · Last modified: 2021/09/13 05:57 (external edit)