On Wednesday, May 1, 2002, at 06:46 AM, OCNS Consulting wrote:
> Of course "srand" seeds "rand". And yes, it is a good way to generate
> random numbers for a one time application RUN.

The original poster is not looking for "random", he's looking 
for "unique".  These are in many ways *opposite* requirements, 
as the only reliable way to get unique IDs is to use a very 
deterministic procedure - a simple iterator is one of the 
easiest and best.

If you have the additional requirement that the unique values 
shouldn't be easily *guessable*, that becomes a very hard 
problem, precisely because "random" and "unique" are such poor 
friends.  Usually people just cheat by generating a large random 
ID such that the probability of it being already-used is low, 
and then they check all the previous IDs to make sure.


  -Ken

Reply via email to