A class for generating random integers. More...
Public Member Functions | |
getRandom ($int1, $int2) | |
Gets a random integer between int1 and int2. | |
getRandomEven ($int1, $int2) | |
Gets a random even integer between int1 and int2. | |
getRandomOdd ($int1, $int2) | |
Gets a random odd integer betwen int1 and int2. |
A class for generating random integers.
The random functions can generate several types of integers based on the functions it contains. It checks input to see if the input is not logical and if it is it returns 0. There is no need to make sure the first int is smaller than the second int, as that is calculated within the function. Everything is calculated using mt_rand().
Definition at line 20 of file random.php.
getRandom | ( | $ | int1, | |
$ | int2 | |||
) |
Gets a random integer between int1 and int2.
It does not matter if int2 is greater than int1 or vica versa.
Definition at line 27 of file random.php.
getRandomEven | ( | $ | int1, | |
$ | int2 | |||
) |
Gets a random even integer between int1 and int2.
It does not matter if the input contains odd numbers. In case two odd numbers are inputted and they are equivalent it returns 0.
Definition at line 37 of file random.php.
getRandomOdd | ( | $ | int1, | |
$ | int2 | |||
) |
Gets a random odd integer betwen int1 and int2.
It does not matter if the input contains even numbers. In case two even numbers are inputted and they are equivalent it returns 0.
Definition at line 58 of file random.php.