Unique random string
| From: | William Ahern | Date: | Tue, 27 Jun 2000 23:34:40 +0000 |
| Subject: | Unique random string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3475@lists.php.net to get a copy of this message | ||
Any ideas on how I can generate a 'guaranteed' unique ascii string less than
15 characters.
It must be guaranteed unique across several independent
servers.
Currently we are generating random short strings to create unique aliases for
email addresses. The only problem is that to guarantee uniqueness we keep a log
of previous strings and check to make sure we don't create duplicates (we cannot
rotate strings. They must be absolutely unqiue for the next decade or so).
The optimal solution would be to generate strings that are truly unique and
hopefully random enough, w/o having to go through the process of checking for
duplicates.
I'd use uniqid(), except that it is 32 characters (too long since users will
have to handle them sometimes) and the algorithm must be available to C, C++,
Perl, whatever.
Any comments, suggestions or answers! ;) would be great.
Please add my address to the reply as I am not subscribed to the list.
TIA,
Bill