throup.org.uk

home on the web for Chris Throup

Random Nonsense

Enjoy the fun of random nonsense generators, but also discover the practical uses for computer-generated gibberish. We will explore a number of different options, from cut-and-paste for straight HTML, to dynamic options utilising PHP or JavaScript.

So what do you mean by “random nonsense”?

Before you ask, I don’t mean the script for Eastenders! In this article, random nonsense refers to content generated (psuedo) randomly by a computer. This may be anything from a non-related series of characters (eg ql)b<<%fs8'`K<pm`0@x) to syntactically, if not semantically, correct prose (eg Ah, this hoarse bird indiscriminately put under a hardy buffalo.).

When would I need this?

A few examples:

Page layout
I don’t know about you, but when I'm designing a new website I’m often tempted to design the layout before any content has been produced. With random nonsense you can fill the space the real content will take up and get a real feel for how the site will eventually look with the real text in place.
Passwords
If you need to generate passwords, nothing can be more secure (or harder to remember!) than a random string of characters. Here's one for you: 13KasSJE.
Secret codes
some drank this less the is fought sobbingly a lividly slew secret impulsive more coded this inarticulately message well indicative. (Try reading every third word in the previous message.)
Just for fun
There are many entertaining uses of random nonsense out on the web. See Crazy Libs from RinkWorks, or the Hobbit Name Generator from Chris Wetherell.

Random characters

I have written a script, Gibberish, for producing random characters, which can be found in my scripts area. Currently it is available as a PHP or JavaScript script, but ports to ASP and Perl are planned.

You can try the script out here. The left column allows you to set options, the middle column displays the actual code used and the right column shows the output. You can select the code format to be used (PHP or JavaScript) but the actual demonstration is run by a PHP script.

Input options
Gibberish type
Encoding
Length of output
Script style
Executed code
Results
Gibberish type
Choose the range of characters for the script to select from as it produces its random string.
Encding
The script can encode its output for use in different environments, through HTML entities and url-encoding.
Length of output
Either enter a number or a string. If a string is entered, the script outputs the same number of characters as were present in the string.
Script style
Choose whether the “executed code” displayed is in the form of PHP or JavaScript.

Random words

Jeff Holman has written a wonderful script called Nonsense, which produces random sentences which are grammatically correct. You can download a copy of the script, with some enhancements of my own, from my scripts area.

You can try the script out here. The left column allows you to set options, the middle column displays the actual code used and the right column shows the output.

Input options
Nonsense type
Length (in sentences or words)
Executed code
Results
Problem connecting!