src/Generator/URandomGenerator.php
public function generate($byteCount)
    {
        $bytes = '';

        if (self::isSupported()) {
            if ($fp = @fopen($this->file, 'rb')) {
                if (function_exists('stream_set_read_buffer')) {
                    stream_set_read_buffer($fp, 0);
                }

                $fileBytes = fread($fp, $byteCount);
                if ($fileBytes) {
                    $bytes = $fileBytes;
                }
            }
        }

        return str_pad($bytes, $byteCount, chr(0));
    }
public function generate($byteCount)
    {
        $bytes = '';

        if (self::isSupported()) {
            if ($fp = @fopen($this->file, 'rb')) {
                if (function_exists('stream_set_read_buffer')) {
                    stream_set_read_buffer($fp, 0);
                }

                $fileBytes = fread($fp, $byteCount);
                if ($fileBytes) {
                    $bytes = $fileBytes;
                }
            }
        }

        return str_pad($bytes, $byteCount, chr(0));
    }
Generate a string of random data.

@param  integer $byteCount The desired number of bytes.
@return string  Returns the generated string.