Re: RFC: getting a unique integer value


Subject: Re: RFC: getting a unique integer value
From: Hubert Figuiere (hfiguiere@teaser.fr)
Date: Mon Oct 15 2001 - 03:26:29 CDT


According to Patrick Lam <plam@plam.lcs.mit.edu>:

> > Thanks to Pat Lam we have a great XP random number generator. This will on
> > average give you an identical random number one in 2^32 attempts. That's
> > approximately 1 in 4,000,000,000 attempts so we're pretty safe :-)
>
> Yes, I used the random number generator from some library.
>
> If you get a collision with two numbers returned from UT_rand in a 32-bit
> address space, you've got other things to worry about; it's far more
> likely that you'll get hit by a truck, or your roof will spontaneously
> cave in.

There are still people that wins lottery. So why not in this case do. In
short, I disagree when you consider that method to be safe.

> Keeping a counter introduces other problems too. You need to lock your
> counter (to prevent problems with concurrency), etc. And it won't make
> you do better.

That is not a really big deal IMHO as you can encaspulate this in a class
that do the whole job.

Hub



This archive was generated by hypermail 2b25 : Mon Oct 15 2001 - 03:24:51 CDT