function rollDice(sides) { return Math.floor(Math.random() * sides) + 1; } function selectRandomNames(names) { if (names.length < 2) { return "Error: Please enter at least two names."; } const shuffled = names.sort(() => 0.5 - Math.random()); return [shuffled[0], shuffled[1]]; } function rollOnTableA() { const roll = rollDice(20); if (roll >= 1 && roll <= 3) return `Roll a d20 for meeting location: ${roll} → Bar`; if (roll >= 4 && roll <= 7) return `Roll a d20 for meeting location: ${roll} → Restaurant`; if (roll >= 8 && roll <= 10) return `Roll a d20 for meeting location: ${roll} → Concert`; if (roll >= 11 && roll <= 14) return `Roll a d20 for meeting location: ${roll} → Park`; if (roll >= 15 && roll <= 17) return `Roll a d20 for meeting location: ${roll} → Military base`; if (roll >= 18 && roll <= 20) return `Roll a d20 for meeting location: ${roll} → Private location`; } function rollOnTableB() { const roll = rollDice(6) + rollDice(6); if (roll >= 2 && roll <= 5) return `Roll 2d6 to determine how their meeting turns out: ${roll} → Things get heated and it turns out the two do not get along one bit. The characters are now Rivals.`; if (roll === 6) return `Roll 2d6 to determine how their meeting turns out: ${roll} → The two characters share a few moments