The Cambridge Study Word Scrambler [Josh Nimoy @ ITP]:

// cambridge word scrambler
// written by Josh Nimoy, September 2003, New York, NY

//According to a research at Cambridge University, it
//doesn’t matter in what order the letters in a word are.
//The only important thing is that the first and last
//letter be in the right place. The rest can be a total
//mess and you can still read it without problem. This is
//because the human mind does not read every letter by
//itself, but the word as a whole.

//Instructions: press the button and scramble the text.

var TOKEN_STRING=1;
var TOKEN_PUNCTUATION=0;
//——————————————————–
function mousePressed(){
	var tokenhash = [];
	var charbuffer = “”;
	var c;
	var n;
	for(i=0;i<textbox1.length;i++){
		c = textbox1.charAt(i);
		n = c.charCodeAt(0);
		//you go here, and you go there.
		if(isAlphaNumeric(n)){
			charbuffer += c;
		}else{
			//flush the buffer
			if(charbuffer.length>0){
				tokenhash.push(TOKEN_STRING);
				tokenhash.push(charbuffer);
				charbuffer=”";
			}
			//add the delimeter
			tokenhash.push(TOKEN_PUNCTUATION);
			tokenhash.push(c);
		}
	}
	//parse the parts
	var type;
	var val;
	var output_accum_lobby;
	for(i=0;i<tokenhash.length;i+=2){
		val = tokenhash[i+1];
		if(tokenhash[i]==TOKEN_STRING){
			output_accum_lobby += cambridgeFuckup(val);
		}else{
			output_accum_lobby += val;
		}
	}
	textbox1 = output_accum_lobby;
}
//——————————————————–
function cambridgeFuckup(word){
	var i;
	for(i=0;i<30;i++){
		if(word.length<=3){
			return word;
		}else{
			var saved_first_char = word.charAt(0);
			var lim = word.length-2;
			var w = word.substr(1,lim+1);
			var r1 = random(lim);
			var r2 = random(lim);
			while(r1==r2){
				r2 = random(lim);
			}
			return saved_first_char + swapChars(w,r1,r2);
		}
	}
}
//———————————————————-
function swapChars(someText, a, b){
	newString = “”;
	var i;
	for(i=0;i<someText.length;i++){
		if(i==a){
			newString += someText.charAt(b);
		}else if(i==b){
			newString += someText.charAt(a);
		}else{
			newString += someText.charAt(i);
		}
	}
	return newString;
}

//— give these functions an ascii val, NOT a string.——-
function isAlphaNumeric(c){// is it a number OR letter?
	return isAlphabetic(c) || isNumeric(c);
}
function isAlphabetic(c){ //is it a letter?
	return( (c>=97 && c<=123) || (c>=65 && c <= 90));
}
function isNumeric(c){// is it a number?
	return( c>=48 && c<=58);
}
//———————————————————-

This work is licensed under a Creative Commons License

<!– Creative Commons License –>

<a href=”http://creativecommons.org/licenses/by-nc-sa/1.0/”><img alt=”Creative Commons License” border=”0″ src=”http://creativecommons.org/images/public/somerights.gif” /></a><br />
This work is licensed under a
<a href=”http://creativecommons.org/licenses/by-nc-sa/1.0/”>Creative Commons License</a>.
<!– /Creative Commons License –>


<!–

<rdf:RDF xmlns=”http://web.resource.org/cc/”
    xmlns:dc=”http://purl.org/dc/elements/1.1/”
    xmlns:rdf=”http://www.w3.org/1999/02/22-rdf-syntax-ns#”>
<Work rdf:about=”">
   <dc:type rdf:resource=”http://purl.org/dc/dcmitype/Interactive” />
   <license rdf:resource=”http://creativecommons.org/licenses/by-nc-sa/1.0/” />
</Work>

<License rdf:about=”http://creativecommons.org/licenses/by-nc-sa/1.0/”>
   <permits rdf:resource=”http://web.resource.org/cc/Reproduction” />
   <permits rdf:resource=”http://web.resource.org/cc/Distribution” />
   <requires rdf:resource=”http://web.resource.org/cc/Notice” />
   <requires rdf:resource=”http://web.resource.org/cc/Attribution” />
   <prohibits rdf:resource=”http://web.resource.org/cc/CommercialUse” />
   <permits rdf:resource=”http://web.resource.org/cc/DerivativeWorks” />
   <requires rdf:resource=”http://web.resource.org/cc/ShareAlike” />
</License>

</rdf:RDF>

–>

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?