RE: insert random number into table

2009-10-19 Thread Jerry Schwartz
44 PM >To: Jerry Schwartz >Cc: Ray; >Subject: Re: insert random number into table > >I always maintain a timestamp in my random numbers. As long as my >precision is higher than my requests per second, wouldn't I be safe >from collisions? Assuming a time machine is not inven

Re: insert random number into table

2009-10-16 Thread Ray
On October 16, 2009 12:29:42 pm Jerry Schwartz wrote: > >-Original Message- > >From: Ray [mailto:r...@stilltech.net] > >Sent: Friday, October 16, 2009 1:10 PM > >To: mysql@lists.mysql.com > >Subject: Re: insert random number into table > > > >On O

Re: insert random number into table

2009-10-16 Thread Scott Haneda
I always maintain a timestamp in my random numbers. As long as my precision is higher than my requests per second, wouldn't I be safe from collisions? Assuming a time machine is not invented. -- Scott Iphone says hello. On Oct 16, 2009, at 11:29 AM, "Jerry Schwartz" > wrote: JS] Just remem

Re: insert random number into table

2009-10-16 Thread Scott Haneda
In addition to what Gavin said. You seem to want some form of key perhaps to be able to identify the authenticity of your contest winner. An auto increment ID won't be very secure for that, but you still need it. Take a known combination of perhaps the key, name, email address, etc, and r

RE: insert random number into table

2009-10-16 Thread Jerry Schwartz
>-Original Message- >From: Ray [mailto:r...@stilltech.net] >Sent: Friday, October 16, 2009 1:10 PM >To: mysql@lists.mysql.com >Subject: Re: insert random number into table > >On October 16, 2009 10:57:48 am Jerry Schwartz wrote: >> There is a RAND function i

RE: insert random number into table

2009-10-16 Thread Gavin Towey
Don't try to give them a random number, instead use a table with a primary key that is AUTO_INCREMENT. Then you just insert the record, and afterwards SELECT LAST_INSERT_ID(); to retrieve the id for the record created. With random numbers, you're going to have more collisions when you add more

Re: insert random number into table

2009-10-16 Thread Ray
On October 16, 2009 10:57:48 am Jerry Schwartz wrote: > There is a RAND function in MySQL, but if you need to guarantee that the > identifiers are unique you should consider using an auto-increment field. > > If that isn't unique enough, you can use the UUID or UUID_SHORT functions. > Theoretically

RE: insert random number into table

2009-10-16 Thread Jerry Schwartz
There is a RAND function in MySQL, but if you need to guarantee that the identifiers are unique you should consider using an auto-increment field. If that isn't unique enough, you can use the UUID or UUID_SHORT functions. Theoretically, those should return values that are unique across the Inter