Re: Re: Random Unique ID

From: Date: Thu, 22 Mar 2007 04:14:02 +0000
Subject: Re: Re: Random Unique ID
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-251066@lists.php.net to get a copy of this message
Actually.... I told you that the possibility of collision is small because I wanted to be scientific.... Scientifically, I can say this posibilty goes to 0... It is a random ID (not a totally random but based on the current timestamp) generated not only once but twice based on two different time stamps..... Safe enough I believe... Regards, Rabih G. Tayyem On 3/22/07, Jim Moseby <JMoseby@nrbindustries.com> wrote:
Rabih Tayyem writes:
PS: I don't take credit for the code as it is a modified version of a code I found long time back (this same code is running on one of my applications for months without any problem)..
Thanks. I'll find use for that! However, altho I know that by making the random number big enough the likelyhood of collisions can be made vanishingly small, I was actually concerned with eliminating the possibility of collisions altogether by checking to see if the number had been used before. I just don't know how to do that properly with Mysql. Perhaps it is necessary to lock to table, check, make the insert and then unlock it. But I was hoping that there would be a simpler way. Replied off-list with a solution. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#251066) next »