Skip to main content
gamedev.net
🔒 Locked

[web] Random text?

Started by PixolMaster 2 replies 600+ views
Original Post
PixolMaster
PixolMaster
Hey all, I'm working on a website, and it has three columns (layed out using tables). I would like the right-hand column to be filled with random text updated each time the page is refreshed. The text has to be able to contain paragraphs and the like... is there any easy way to do this? I can't figure out how to do anything other than small un-formated bits of text or images. Any help would be GREATLY appreciated. Thanks ahead of time.
SiCrane
SiCrane
My first instinct would be to run a Markov chain off of a dataset containing the Old Testament, Alice in Wonderland, and Pride and Prejudice. Of course, I'm weird.

So exactly how random does your text need to be? Does it need to be random words that still look like paragraphs, with rough sentence structure, etc.? Or do you just want a random dictionary spew?
PixolMaster
PixolMaster
Hmm, I think I did a horrible job explaining what I need. Here's a better explaination:

I need to take a number of blurbs (seperated into paragraphs), store them in a file or database of some sort and then randomly pick from them each time the page is refreshed. Specifically, each blurb is a chapter summary for a book.

I see now how poorly worded my initial request was... hopefully this one is better.
Alan Kemp
Alan Kemp
I would put them into a database table (one per row), and then use a simple SQL query to select a random one each time the page it loaded (assumming the page is php/sql/asp/etc).

SELECT * FROM quotes ORDER BY RAND() LIMIT 1


Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.