Thread: Random page
View Single Post
Old 09-13-2011, 01:05 PM   #12
elcreative
Wizard
elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.elcreative ought to be getting tired of karma fortunes by now.
 
Posts: 2,888
Karma: 5875940
Join Date: Dec 2007
Device: PRS505, 600, 350, 650, Nexus 7, Note III, iPad 4 etc
Quote:
Originally Posted by emellaich View Post
I'd think it would be pretty easy as an HTML/Web app. Say you have 100 poems. Put each on it's own web page with a next poem button.

Name each poem numerically 1.html, 2.HTML, ...

Now use javacript to select a random number from one to one hundred. Stick this into the target address for the next poem button. So the next poem might take you to:
"http:\\www.mypoems.com\" + random-number + ".html". Which might translate to:

http:\\www.mypoems.com\56.html
Since the OP doesn't want a repeat of any poem until a complete run through, it is necessary to keep a list of every number used and not allow a reuse until all used, this could lead to a long hunt time after 98 poems while your random number generator generates used numbers. Better approach is a list of the 100 poems and as a number is used then delete from list and drop random number generator by one...
elcreative is offline   Reply With Quote