Files
decision-maker/backend/nodejs/random-decision.js

23 lines
361 B
JavaScript

const random = require('random');
class Choice {
constructor(name) {
this.name = name;
}
toString() {
return this.name;
}
}
const choices = [
new Choice('A'),
new Choice('B'),
new Choice('C')
];
exports.getRandomChoice = () => {
return choices[random.int(0, choices.length - 1)];
}
exports.choices = choices;