Generation

generate functionThu, 17 Nov 2022

Generate random sentence from lists

function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } function generateName(adjectives, animals) { return adjectives[getRandomInt(adjectives.length)] + " " + animals[getRandomInt(animals.length)]; } generateName(["skinny", "fat", "smelly", "generous"], ["cat", "dog", "fish", "horse"])

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant