> > > > *] I need to generate a RANDOM UNIQUE number for every new record.
Is
> > there an
> > > > *] easy way to accomplish this inside of mySQL.
> > > > *]
> >
> > What are the requirements for 'random' and 'unique'? Do you need some
sort
> > of cryptographic randomness? Does uniqueness be kept across tables?
> >
> > If you 'only' need a unque id you could you AUTO_INCREMENT. If you want
> > uniqueness to carry over tables etc. you could take a look at the
aproach
> > made by the Apache module mod_unique_id. If you need a cryptographic
> > randomness you should look into some litterature about the area so as to
get
> > a better understanding of what you truly need.
>
> Would an MD5 encryption be another option?  Use a auto incrementing ID to
> keep your records sorted, then the MD5 field for your unique randomness.

Good idea. Practical and easy (there are a lot fast MD5 implementations easy
accessable).

That should take care of the cryptographic randomness. Uniqueness won't be
true across tables but that might not be necessery. If it was a value
similar to mod_unique_id could be MD5'ied.

--
Aigars



---------------------------------------------------------------------
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