|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||||
|
||||||
|
how random are the spotlights?
I seem to see the same quote by Dr. Bot "The big lesson we learned ... our past does not limit our future, that superior attitude will beat out big budgets." several times per session. I've even seen it on 3 consecutive pages. So...just how random are the spotlights?
|
|
#2
|
|||||
|
|||||
|
Code:
SELECT * FROM cd_spotlight WHERE approved>0 ORDER BY RAND() LIMIT 1 [EDIT]ok, its changed. Hopefully it'll be a bit more random.[/EDIT] Last edited by Brandon Martus : 01-11-2003 at 04:10 PM. |
|
#3
|
||||
|
||||
|
How did you change it? I noticed on one of my sites long ago that rand really doesn't work too well like that.
|
|
#4
|
|||||
|
|||||
|
Pulled in the whole data set, didn't limit it to 1 row. I then used php's rand() function, and took a random number from 1->[# of records in dataset]. And then showed that row.
Hopefully random row of a randomly sorted dataset will be a bit more random. :shrug: |
|
#6
|
|||||
|
|||||
|
One's from mysql's 'ORDER BY RAND()', the other's from php's rand() function.
Oh, and from php.net's man page for srand(). Quote:
|
|
#7
|
||||||
|
||||||
|
my bad. I'm just used to C's rand() that does nothing useful uless you seed it. Sorry about that.
|
|
#8
|
||||
|
||||
|
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| External Spotlights | Brandon Martus | CD Forum Support | 17 | 12-04-2003 09:38 PM |
| Match Pairings not random (not even close!) | Norm M. | General Forum | 74 | 03-31-2003 08:22 AM |
| About people and their random posting | archiver | 2001 | 5 | 06-24-2002 04:21 AM |
| How random is random???? | archiver | 1999 | 0 | 06-23-2002 09:59 PM |
| Silly Random Team Site | Matt Leese | Rumor Mill | 1 | 07-13-2001 10:47 PM |