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

        if (self::isSupported()) {
            $mcryptStr = mcrypt_create_iv($byteCount, MCRYPT_DEV_URANDOM);
            if ($mcryptStr !== false) {
                $bytes = $mcryptStr;
            }
        }

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

        if (self::isSupported()) {
            $mcryptStr = mcrypt_create_iv($byteCount, MCRYPT_DEV_URANDOM);
            if ($mcryptStr !== false) {
                $bytes = $mcryptStr;
            }
        }

        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.