Go to Post It's not about the numbers, it's what you can do with them. - AlecMataloni [more]
Home
Go Back   Chief Delphi > ChiefDelphi.com Website > CD Forum Support
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-01-2003, 13:55
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,573
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 11-01-2003, 16:02
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
Code:
SELECT * FROM cd_spotlight WHERE approved>0 ORDER BY RAND() LIMIT 1
I've found (and now you) that mysql rand() function isn't too random. I will be changing it slightly soon, to hopefully be a bit more random.


[EDIT]ok, its changed. Hopefully it'll be a bit more random.[/EDIT]
__________________
Brandon Martus
e-mail

Last edited by Brandon Martus : 11-01-2003 at 16:10.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-01-2003, 17:34
AJ Quick's Avatar
AJ Quick AJ Quick is offline
Your Attention Please
FRC #0006 (CogSquad)
Team Role: Alumni
 
Join Date: Oct 2002
Rookie Year: 2001
Location: Minnesota
Posts: 464
AJ Quick has a spectacular aura aboutAJ Quick has a spectacular aura about
How did you change it? I noticed on one of my sites long ago that rand really doesn't work too well like that.
__________________
-AJ Quick (Alum on Team 6)
http://www.HHSRobotics.com/

Place your attention entirely on my voice and try to ignore all the others. It is important to be able to focus on a single source of information while blocking out all the other things competing for your attention.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-01-2003, 17:57
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
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:
__________________
Brandon Martus
e-mail
Reply With Quote
  #5   Spotlight this post!  
Unread 11-01-2003, 18:00
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Might you need to use srand? Taking a random number twice won't do any good if it starts with the same seed value.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
Reply With Quote
  #6   Spotlight this post!  
Unread 11-01-2003, 18:09
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
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:
Note: Since PHP 4.2.0 it's no longer necessary to seed the random number generator before using it.
__________________
Brandon Martus
e-mail
Reply With Quote
  #7   Spotlight this post!  
Unread 11-01-2003, 18:12
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
my bad. I'm just used to C's rand() that does nothing useful uless you seed it. Sorry about that.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
Reply With Quote
  #8   Spotlight this post!  
Unread 11-01-2003, 23:27
AJ Quick's Avatar
AJ Quick AJ Quick is offline
Your Attention Please
FRC #0006 (CogSquad)
Team Role: Alumni
 
Join Date: Oct 2002
Rookie Year: 2001
Location: Minnesota
Posts: 464
AJ Quick has a spectacular aura aboutAJ Quick has a spectacular aura about
Quote:
Originally posted by Brandon Martus
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.
Ah, not that bad of a way to go that, just as long as it doesn't slow the site down too much. I don't know why they don't make that rand feature better with mySQL.. it is so useful.
__________________
-AJ Quick (Alum on Team 6)
http://www.HHSRobotics.com/

Place your attention entirely on my voice and try to ignore all the others. It is important to be able to focus on a single source of information while blocking out all the other things competing for your attention.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
External Spotlights Brandon Martus CD Forum Support 17 04-12-2003 21:38
Match Pairings not random (not even close!) Norm M. General Forum 74 31-03-2003 08:22
About people and their random posting archiver 2001 5 24-06-2002 04:21
How random is random???? archiver 1999 0 23-06-2002 21:59
Silly Random Team Site Matt Leese Rumor Mill 1 13-07-2001 22:47


All times are GMT -5. The time now is 19:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi