RandomReader
class RandomReader extends AbstractGenerator (View source)
Generates bytes reading directly from the random device.
RandomReader generates random bytes by reading directly from the random device (i.e. from /dev/urandom or /dev/random).
Methods
Reads bytes from the randomness source.
Creates new instance of RandomReader.
Closes the file pointer.
Tells if the generator is supported by the operating system.
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 50
protected string|false
readBytes(int $count)
Reads bytes from the randomness source.
at line 27
__construct(bool $urandom = true)
Creates new instance of RandomReader.
at line 36
__destruct()
Closes the file pointer.
at line 45
bool
isSupported()
Tells if the generator is supported by the operating system.