Re: Unique random string
| From: | David VanHorn | Date: | Wed, 28 Jun 2000 00:30:14 +0000 |
| Subject: | Re: Unique random string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3482@lists.php.net to get a copy of this message | ||
At 04:34 PM 6/27/00 -0700, William Ahern wrote:
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.There's the killer requirement. I'm doing something similar for user IDs. You can pre-generate a list, and have each system use the next number in the stack. Not random, but from a given set of numbers, you cannot predict the next number. Or, you can generate a number, mark it as "holding" and query each server, to see if they have a dupe, or are "holding" the same number (they may be querying you at the same time) then accept if nobody else has it... Like most of these problems, it hinges on what you mean by "random". -- www.SpamWhack.com A pre-emptive strike against spam A tornado is a lady whose skirts you do NOT want to look up! Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9