Skip to content

Instantly share code, notes, and snippets.

@DanielJWood
Created November 21, 2018 16:19
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 DanielJWood/16158fb57839dc8f89c06366eebd0d83 to your computer and use it in GitHub Desktop.
Save DanielJWood/16158fb57839dc8f89c06366eebd0d83 to your computer and use it in GitHub Desktop.
Function to grab a random number of words from a random list of words
function getRandomTitle() {
var words = "suricate homonomous unconsiderable asphaltene sturdiness Trionyx pigmentation episcope torchlight keynoter Kharia osmose Halteridium underproduce misbecomingly compulsory zyme overdaringly Cristivomer unaffrightedly bailey septemplicate alterity sarcophagy"
var words = words.split(" ")
var max = 10;
var min = 3;
var num = Math.floor(Math.random() * (max - min) ) + min;
var num2 = Math.floor(Math.random() * (max - min) ) + min;
var randTitle = "";
for (var i = 0; i < num; i++) {
randTitle = randTitle + " " + words[i+num2];
}
return randTitle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment