[thelist] math help...

Shawn K. Quinn skquinn at speakeasy.net
Sat Mar 18 23:43:56 CST 2006

On Fri, 2006-03-17 at 13:11 -0500, Brian Cummiskey wrote:
> They need to be random, as they are given to sales reps as their 
> commission ID.  If they learn that its just the next number in order, 
> there could be some cheating.

...and finally we get to the real problem that needs to be solved.

The simplest solution I see would be to use the first four characters as
a sequential (base 36, if need be) number, then generate a check digit
for the fifth character, such that not every sales representative ID is
even valid. The credit card companies do this and I would say it works
rather well (combined with other anti-fraud techniques required in the
banking industry).

Of course, now that you've already done it a different way, you would
need to retire all the old sales representative commission IDs and issue
new ones. You could just generate a check digit for the existing IDs and
use that for the sixth character. Then, start assigning consecutive IDs
from some point in the sequence. If you're getting duplicates already,
the random number generation you're using is junk anyway.

(Just to be sure everyone understands, the "digit" does not imply "0 to
9 only" since we are possibly dealing with base 36 numbers.)

Shawn K. Quinn <skquinn at speakeasy.net>

More information about the thelist mailing list