Created
November 21, 2018 16:19
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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