Pseudorandom number generator (PRNG)
Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback
Parameters: |
|
---|---|
Return type: | string |
Throws : | ExceptionRuntimeException |
Generate random boolean
Parameters: | bool – true if you need a strong random generator (cryptography) |
---|---|
Return type: | bool |
Generate a random integer between $min and $max
Parameters: |
|
---|---|
Return type: | integer |
Throws : | ExceptionDomainException |
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.
Parameters: | bool – true if you need a strong random generator (cryptography) |
---|---|
Return type: | float |
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.
Parameters: |
|
---|---|
Return type: | string |
Throws : | ExceptionDomainException |