Skip to content

Instantly share code, notes, and snippets.

@jeffcarp
Last active October 13, 2015 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffcarp/4158401 to your computer and use it in GitHub Desktop.
Save jeffcarp/4158401 to your computer and use it in GitHub Desktop.
Gibberish
// Generate a random string of characters
function gibberish(max_length) {
var gibberish = '';
var ascii;
while (max_length > 0) {
ascii = Math.floor(Math.random()*58)+65;
if (ascii >= 91 && ascii <= 96) continue;
gibberish += String.fromCharCode(ascii);
max_length -= 1;
}
return gibberish;
}
// Minified and pre-loaded
(function gibberish(e){var t="";var n;while(e>0){n=Math.floor(Math.random()*58)+65;if(n>=91&&n<=96)continue;t+=String.fromCharCode(n);e-=1}return t})(10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment