gregory-jagermeister_Fantas.../generators/drink.ts
2023-02-09 00:13:11 +11:00

17 lines
No EOL
593 B
TypeScript

import { drinkGeneratorSettings } from "main";
export function generatorDrinks(settings: drinkGeneratorSettings) {
const adjectives = settings.adj;
const nouns = settings.nouns;
let adjectivetotal = "";
const numAdjectives = Math.random() < 0.5 ? 1 : 2;
for (let i = 0; i < numAdjectives; i++) {
const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
adjectivetotal += randomAdjective + " ";
}
const randomNoun = nouns[Math.floor(Math.random() * nouns.length)];
return `${adjectivetotal} ${randomNoun}`;
}