I need to use rand() to generate pseudorandom numbers. They won't be used for cryptographic purposes so the true randomness is not a concern - they just need to be different from previous ones. What I need to do is to generate numbers that do not appear in a mysql query. I thought I would load the numbers into an array then compare rand() output to the array. Is there a better way to do it?