Re: [PHP] Re: Random Unique ID

2007-03-23 Thread Richard Lynch
On Wed, March 21, 2007 5:40 pm, [EMAIL PROTECTED] wrote: > Thanks. Yes, I check for errors. But there are other types of errors > so I'd need to verify that it is a duplicate key error and, in my > ignorance, I have not yet figured out how to do that programatically. > I worry about getting into

Re: [PHP] Re: Random Unique ID

2007-03-23 Thread Satyam
I'm sorry if I am repeating something that has been said, but in the comments to: http://es2.php.net/manual/en/function.uniqid.php there is a little piece of code that generates UUID as per RFC 4122, and those get as unique as they come. MySql has a UUID() function and so do any database eng

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Mark
Tijnema ! wrote: > On 3/22/07, markw@mohawksoft.com wrote: >> > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> >> > Tijnema ! wrote: >> >> > >> >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> >> > >> >> >> > >>

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, markw@mohawksoft.com wrote: > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> > Tijnema ! wrote: >> > >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> > >> >> > >> http://www.ossp.org/pkg/lib/uuid >> > >

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread markw
> On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> > Tijnema ! wrote: >> > >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> > >> >> > >> http://www.ossp.org/pkg/lib/uuid >> > > >> > > Note that this doesn't gonna work w

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: > Tijnema ! wrote: > > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > >> > >> http://www.ossp.org/pkg/lib/uuid > > > > Note that this doesn't gonna work when safe mode is on..!

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Roman Neuhauser
# markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: > Tijnema ! wrote: > > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > >> > >> http://www.ossp.org/pkg/lib/uuid > > > > Note that this doesn't gonna work when safe mode is on..! Ralf S. Engelschall's OSSP UUID library wrapped in a P

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Mark
Tijnema ! wrote: > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: >> > Mark wrote: >> > >[EMAIL PROTECTED] wrote: >> > > >> > >>Hello, >> > >> >> > >>I want to add a random unique ID to a Mysql table. Collisions >> > >>are unlikely but p

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: # [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: > Mark wrote: > >[EMAIL PROTECTED] wrote: > > > >>Hello, > >> > >>I want to add a random unique ID to a Mysql table. Collisions > >>are unlikely but possible so to handle those cases I'd like

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: > Mark wrote: > >[EMAIL PROTECTED] wrote: > > > >>Hello, > >> > >>I want to add a random unique ID to a Mysql table. Collisions > >>are unlikely but possible so to handle those cases I'd like to > >>regenerate the random ID until there is no collisi

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Thu, 2007-03-22 at 08:14 +0400, Rabih Tayyem wrote: > 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... Only as the length of the ID approaches infinity :B Cheers, Rob. -- .---

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Rabih Tayyem
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 s

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 16:40 -0600, [EMAIL PROTECTED] wrote: > Jim Moseby writes: > > >> 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 >

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Stut
[EMAIL PROTECTED] wrote: Stut writes: [EMAIL PROTECTED] wrote: I want to add a random unique ID to a Mysql table. Collisions are unlikely but possible so to handle those cases I'd like to regenerate the random ID until there is no collision and only then add my row. Any suggestions for a newb

RE: [PHP] Re: Random Unique ID

2007-03-21 Thread Jim Moseby
> 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

Re: [PHP] Re: Random Numbers..

2003-12-08 Thread Curt Zirzow
* Thus wrote Burrito Warrior ([EMAIL PROTECTED]): > > This would: > /* selecting a random record, where n = 1. Works fine on small tables */ > mysql> SELECT value FROM table ORDER BY RAND() LIMIT n; > > /* selecting a random record. This is good on large tables if numbering > sequence is used *

RE: [PHP] Re: Random Numbers..

2003-12-06 Thread Burrito Warrior
No, I wouldn't do that. What if another quote gets deleted. The new assigned QuoteID would be 6 and your solution wouldn't work. This would: /* selecting a random record, where n = 1. Works fine on small tables */ mysql> SELECT value FROM table ORDER BY RAND() LIMIT n; /* selecting a random re

RE: [PHP] Re: Random numbers in a cronned script?

2002-09-13 Thread Martin Towell
if you seed it with unix time then you'll alway be seeding with something different in most cases, the random numbers that are generated will be random enough just my AU2c worth Martin -Original Message- From: lallous [mailto:[EMAIL PROTECTED]] Sent: Friday, September 13, 2002 6:51 PM To

Re: Re: [PHP] Re: Random

2001-12-19 Thread David
yeah, my linux(Mandrake 8, Apache 1.3.22, PHP 4.1.0) box also gives me a 6 digit integer each time too. but when i tried on my win32 (Win2k, Apache 1.3.22, PHP 4.1.0), it is limited to a max of 32767 as indicated with getrandmax(). the origional author of the problem probably using windows to

Re: [PHP] Re: Random

2001-12-19 Thread Knut H. Hassel Nielsen
On 19 Dec 2001, David wrote: > should be because rand() can\'t generate such a large number for u. > > use $max_random_number = getrandmax(); to check > > http://sg.php.net/manual/en/function.getrandmax.php Hmmm... My webserver gives me no problems witht this at all. (Sun E250 with Solaris 8, A