Kyle Hayes wrote:

> On Friday 26 October 2001 10:00, Dana Holt wrote:
> > Can I automatically generate a random, unique, integer value in a certain
> > range when inserting data into a column using SQL?
> >
> > If so, how?
>
> Random is easy.  Just find a good RNG (random number generator) somewhere
> (there are many available on the 'net, search on Google).  Or, use the RAND
> function that comes with MySQL.  You can find RNGs that have extremely long
> periods.
>
> Unique is easy.  Just use an auto-increment field in MySQL.
>
> Random _and_ unique are not that simple.

You could put both a number from RAND and an auto-increment field to ensure
uniqueness when combining the two.

But of course crypographicly, that is not a good idea.

b.
mysql



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to