In response to Craig Ringer <craig@postnewspapers.com.au>:
> Bill Moran wrote:
>
> > Sounds like you're reinventing message digests ...
[snip your comments about why I was wrong about MDs working]
> So long as I don't call it "xor encryption" ... sigh.
>
> > Most of the systems I've seen like this do one of a few things:
> > * Start with an arbitrary # like 1000
> > * Prepend the date (pretty common for invoice #s) like 20090501001
> > * Just start with #1 ... I mean, what's the big deal?
>
> I'm not the one who cares. Alas, I've been given requirements to
> satisfy, and one of the major ones is that customer numbers in
> particular must be non-sequential (as close to random-looking as
> possible) and allocated across a large range.
Why not just grab random values for that one, then? Just generate
a random value, check to ensure it doesn't already exist ... rinse
and repeat if it's a duplicate. I mean, how often is this system
adding new customers?
Another trick with the invoice #s is to prepend them with a subset
of the client ID. You could also use the same technique ... generate
a random value, repeat if it already exists ...
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/