echo random_bytes($length);
$str=random_bytes(7); echo bin2hex($str);
f058fdbf918d88
Post your comments , suggestion , error , requirements etc here