Internal
class Internal extends AbstractGenerator implements NumberGenerator (View source)
Generates bytes and numbers using PHP's built in CSPRNG.
PHP7 offers a built in function for generating cryptographically secure random bytes. This class simply wraps that method for supported PHP versions.
Methods
Reads bytes from the randomness source.
Tells if the generator is supported by the operating system.
Returns a securely generated random number between minimum and maximum.
Details
in AbstractGenerator at line 15
string
getBytes(int $count)
Returns securely generated random bytes.
This method will always return the correct number of bytes that have been securely generated. If the bytes cannot be securely generated or if the correct number of bytes cannot be generated, the method MUST throw an exception.
at line 24
protected string|false
readBytes(int $count)
Reads bytes from the randomness source.
at line 19
bool
isSupported()
Tells if the generator is supported by the operating system.
at line 29
int
getNumber(int $min, int $max)
Returns a securely generated random number between minimum and maximum.