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 *

[PHP] Re: Random Numbers..

2003-12-07 Thread Luke
select all and use mysql_data_seek($result, rand(mysql_num_rows($result) - 1)); $row = mysql_fetch_assoc($result); and there, your random row is returnd, that should be easy enough :) and it should work -- Luke "Theheadsage" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hey, > >

RE: [PHP] Re: Random Numbers..

2003-12-06 Thread Burrito Warrior
CTED] Subject: [PHP] Re: Random Numbers.. Theheadsage wrote: > Hey, > > I've got a script which used to generate a random quote. It worked fine > untill this problem occurred.. > > Say we have 4 quotes with QuoteID's of 1 through to 4 > The script would grab a number

[PHP] Re: Random Numbers..

2003-12-06 Thread Alex
Theheadsage wrote: Hey, I've got a script which used to generate a random quote. It worked fine untill this problem occurred.. Say we have 4 quotes with QuoteID's of 1 through to 4 The script would grab a number of rows, and generate a random number between 1 and this value (being 4 in this case)

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

2002-09-13 Thread Martin Towell
51 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Random numbers in a cronned script? Yes, you're right about that point since the seed in most cases is computed from system time => increasing probability of having same number @ the same request time... you can change the seed with the time()

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

2002-09-13 Thread lallous
Yes, you're right about that point since the seed in most cases is computed from system time => increasing probability of having same number @ the same request time... you can change the seed with the time() too (not all days are the same). hope to hear others' opinions too. Elias "Leif K-Brook

[PHP] Re: random numbers help

2001-10-05 Thread Richard Lynch
You should call mt_srand((double) microtime() * 100) once, and only once, in any given script. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmus

[PHP] Re: random numbers help

2001-10-05 Thread Henrik Hansen
[EMAIL PROTECTED] (Nikola Veber) wrote: > Hi ! > I'm having troubles with the random numbers. When I create a number witm mt_rand() > I always get the same number on my local server. I need this stuff to ranomly >display > some text, and I'd like to have another value of the random number