 |

01-22-2004, 11:54 AM
|
 |
Greater Overmind
Greater Overmind
|
|
Join Date: Feb 2003
Location: Colorado
Posts: 887
Rep Power: 6
|
|
Predictable Randomness
If it can be done, and it can be done without rewriting PHP, I'd like to have a quote generator that is both random and predictable. That way I can print out quotes that are always the same on a given date, but tomorrow's quote would be randomly different. So, I have a series of quote ids in my database and i want to pick one based on today's date without having a lot of repitition. I guess it would then be called "Today's Quote" and I'd be able to have people discuss "Today's Quote."
I thought of running a random generator script once and then storing the id until the next day, but that didn't sound as fun as having a script that somehow magically chose the same quote every day... ya know, the more I think about this, the more unlikely it sounds achievable. Throw the thing to the dogs :2guns: if you can't come up with anything....
__________________
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. - Galileo Galilei
Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. - Thomas Jefferson (3rd US President, author of the Declaration of Independence)
Justice is the [ultimate goal] of government. It is the [ultimate goal] of civil society. It ever has been and ever will be pursued until it be obtained, or until liberty be lost in the pursuit. - James Madison (4th US President, "father" of the US Constitution)
|

01-23-2004, 11:19 AM
|
 |
Administrator
Great Diviner
|
|
Join Date: Aug 2002
Location: Maine
Posts: 5,248
Rep Power: 10
|
|
Um, maybe I'm just a little daft, but I have no idea what you're talking about. :huh:
Are you saying that you want a random quote generator that doesn't repeat itself very often? Or that always says the same quote for a specific date, day of week, etc?
I don't get it! But it can probably be done.
|

01-23-2004, 11:49 AM
|
 |
Greater Overmind
Greater Overmind
|
|
Join Date: Feb 2003
Location: Colorado
Posts: 887
Rep Power: 6
|
|
Quote:
|
Originally Posted by Tekime
Um, maybe I'm just a little daft, but I have no idea what you're talking about. :huh:
|
lol - I don't blame you. I usually come to the forums with a question like this when I'm in a state of daftness myself, not knowing where to start off and all that. This is what I want:
I have a list of quotes in my database; that list could change from 3 entries to 400 entries over time. Each day, however, as in each day of time in existence, I want to be able to display a different, random quote on my page. What I'm trying to get away from is every time the page loads, a new, random quote appears. For each day, I want one and only one quote, but still yet random over the days of time.
I'll probably just store the id somehow and do it that way... :nuts:
__________________
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. - Galileo Galilei
Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. - Thomas Jefferson (3rd US President, author of the Declaration of Independence)
Justice is the [ultimate goal] of government. It is the [ultimate goal] of civil society. It ever has been and ever will be pursued until it be obtained, or until liberty be lost in the pursuit. - James Madison (4th US President, "father" of the US Constitution)
|

01-27-2004, 11:23 AM
|
 |
Administrator
Great Diviner
|
|
Join Date: Aug 2002
Location: Maine
Posts: 5,248
Rep Power: 10
|
|
Okay, I gotcha now. You could create a lastViewed date field and update the current time every time you view one. Then you could just select the quote with the oldest date when the date of the most recently accessed quote is equal to or greater than 24 hours less than today's date.
|

01-28-2004, 01:53 PM
|
 |
Greater Overmind
Greater Overmind
|
|
Join Date: Feb 2003
Location: Colorado
Posts: 887
Rep Power: 6
|
|
Right on. Sounds like a plan. Thx
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:27 PM.
|
|