/** * Returns a string of random bytes. * * @param integer $count Number of bytes to generate * @return string Random bytes */ public static function generateRandomBytes($count) { return \Security_Randomizer::getRandomBytes($count); }
/** * Returns a random GUID. * * @return string */ public static function getRandomGUID() { $hex = strtoupper(bin2hex(Security_Randomizer::getRandomBytes(16))); return substr($hex, 0, 8) . '-' . substr($hex, 8, 4) . '-' . substr($hex, 12, 4) . '-' . substr($hex, 16, 4) . '-' . substr($hex, 20, 12); }