i would have used $rand then used a while to parse the digits and add your colors(would be a lot more colorful)
in the end, you really just used $rand to make your random number. I kinda expected u had actually wrote a random number algorithm or used a socket to pull a "true" random number from a site.
Other than its usefulness, good job, keep it up, and get working on that algo ;)