One option would be to generate two MD5 hashes, combine them together (a total of 64 hexadecimal characters), and then take the first 36 characters from this:
SELECT SUBSTR(CONCAT(MD5(RAND()),MD5(RAND())),1,36)
(NOTE: the MD5 hash is 128 bits, the MySQL MD5 () function returns 32 hexadecimal characters.)
source share