Thread: Random Text
View Single Post
Old 05-07-2008, 11:53 AM   #4 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

on the face of it it may sem complex but its actually quite simple (que pseudo(ish)code)

make an array of words
count how many words we have
loop over and make a random number
check the number to see if it already is in the random number array
if not continue, but if it does exist loop until a random number is produced that is unique

then loop over again but use the random number from the random number array as an index for the word array and echo it

make sense?
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote