Misanthropy Today

Because If You Don’t Hate Others Nobody Else Will

space
In An effort to make Misanthropy Today a more funny blog I randomized the homepage since most of my new articles are pretty craptastic. Turns out everyone hated it. Ok have it your way. It's back to normal now.
Please send Submissions, Tips, Suggestions, Naked Pics, Etc.
space

Make A Random Word Generator

Monday, 09 Feb 2009
 

I found this Internet Argument Generator here.

Press escape to form an opinion about something:

InternetArgumentGenerator

After refreshing and pressing escape a few times I was curious to see the entire word list so that I didn’t have to hit refresh and escape like some monkey. I looked at the page source and was suprised that there wasn’t one or several files filled with words— they’re GIF files!

Amazing.

I made a metal band name generator some time ago and also a word generator that uses any letters you type in to form a word (this was to help me cheat at Yahoo Literati/Scrabble).

This is the good thing about technology– you can use it to make things that are useful (or not useful) to make your life easier or have a few laughs.

I made the scrabble cheat tool  because I was too cheap to buy this program I was using and my trial period had ended and I figured I could make it in about 20 mins and save the money.

For the first word of my metal band name generator I used calendar months, bad ass words like ‘violent’  and ’sword’ and for the second word I used abstract nouns that sound scary like ‘descent’, ‘purgatory’  etc.

Click it your band name might be:

January Descent or Poison Purgatory. Not bad names.

If you want to make a random word generator for your site open up a notepad file and make one called “randomgenerator.php” or whatever  name you like.

Make a few text files and fill them with words that you think will make an interesting combination.  Name those however you want (in the example below I used word1-3 and saved them as txt files in the directory.

The code in your namegenerator.php file might look like this (if this is busch league and you know a shorter way please comment):


$files = array('word1.txt', 'word2.txt', 'word3.txt');

$delim = “\n”;
foreach($files as $wordfile){
$i++;
if($i == 3){
print ” – “;
}else{
print ” “;
}
$fp = fopen($wordfile, “r”);
$contents = fread($fp, filesize($wordfile));
$word_arr = explode($delim,$contents);
fclose($fp);
srand((double)microtime()*1000000);
$word_index = (rand(1, sizeof($word_arr)) – 1);
$hereword= $word_arr[$word_index];
echo $hereword;

}
?>

You'll just need to use the include statement to drop these into your page. Something like this:

>? include("randomgenerator.php"); ?>

You can then use this piece of javascript to refresh the page:

Click to refresh the page

Or yanno.. you can just put a link to that page with the anchor text "click here to refresh"--- nobody will know the difference.

Random Posts

Loading...



Reader's Comments

  1. this is busch league and I know a shorter way

  2. damnit tom don’t start with me today

Leave a Comment