Random bytes, ints, UUIDs in PHP.md Random bytes, ints, UUIDs in PHP Simple and safe random getters to copy-paste string randomBytes( int $length ) int randomInt ( int $min , int $max ) string randomUuid ( void ) For simple implementation of the deterministic UUID versions, see this Gist but I don't recommend using my_rand() for random UUIDs. Only uses quality randomness sources You can trust thes