This code provides a function to generate ,lightweight, cryptographically secure random bytes in all versions of PHP. It makes use of different secure functions or operating system randomness. If non is available then a clock drift algorithm is used to generate entropy. The function is tested in Ubuntu/Debian Linux, Sun Solaris and Windows XP/2003. -
View it on GitHub