| Fully Qualified Name: | Zend\Math\Rand |
Pseudorandom number generator (PRNG)
| Name | Description | Defined By |
|---|---|---|
| getBoolean() | Generate random boolean | Rand |
| getBytes() | Generate random bytes using different approaches If PHP 7 is running we use the random_bytes() function | Rand |
| getFloat() | Generate random float [0. | Rand |
| getInteger() | Generate a random integer between $min and $max | Rand |
| getString() | Generate a random string of specified length. | Rand |
Generate random boolean
Returns: bool
Generate random bytes using different approaches If PHP 7 is running we use the random_bytes() function
| Parameter Name | Type | Description |
|---|---|---|
| $length | int |
Returns: string
Generate random float [0.
.1) This function generates floats with platform-dependent precision
PHP uses double precision floating-point format (64-bit) which has 52-bits of significand precision. We gather 7 bytes of random data, and we fix the exponent to the bias (1023). In this way we generate a float of 1.mantissa.
Returns: float
Generate a random integer between $min and $max
| Parameter Name | Type | Description |
|---|---|---|
| $min | int | |
| $max | int |
Returns: int
Generate a random string of specified length.
Uses supplied character list for generating the new string. If no character list provided - uses Base 64 character set.
| Parameter Name | Type | Description |
|---|---|---|
| $length | int | |
| $charlist | string|null |
Returns: string