can anyone help ?
George
"Mel" <m...@redolive.com> wrote in message
news:rEG8b.5$B65....@news.uswest.net...
You do realize that these two requirements are incompatible, right? Random
numbers won't necessarily be unique. You'll need to keep a list of all the
serial numbers you've used so far, then check each (pseudo-)random new
serial number against the list.
I'm not sure why you'd want a random number for a serial number, anyway.
Most serial numbers used in the real world actually have useful information
coded into themm - like the date of manufacture for hardware. This comes in
handy when you need to do a recall later ;-)
-Mark
> i need to create random unique serial numbers, say 10 chars + digits
> combined
Basically, I use the following:
format %08x%08x%s [clock seconds] [clock clicks] [md5::md5 $hash]
hash is some unique string identifying a machine - for example in a
client connecting to a server, I do hash from some random string and all
the usernames/hostnames.
It is not random, but unique (although it is 48 bytes - though you could
use base64 instead of hex and get 32 bytes).
--
WK