Subject | Re: random number generator? |
---|---|
Author | Svein Erling Tysvær |
Post date | 2004-08-13T11:59:15Z |
> My reasons:No, you do not need a two-field key. Suppose your client has a few
>
> consider this: I have a client who does door-to-door sales of kiosk
> supplies. He has a number of salesmen with portable PC's who at the
> end of the day must come update the office DB. Having randomly
> generated keys makes this simple. Mathematically, the chance of two
> identical keys still exists, but it is practically nil.
>
> Curently I am inserting a random number from the application but I
> want to change this to a trigger or something.
>
> I can do what I want using a two-field key, but I would rather not.
salesmen and that the number of salesmen will not exceed 1000 for the
foreseeable future. Then you initialize your generator to 1 for the
first computer, 2 for the second and so on and instead of incrementing
by 1 for each sale you increment the generator by 1000. This
eliminates the mathematical chance of two identical keys in a very
simple way.
Set