lila/ui/learn/src/congrats.ts

30 lines
434 B
TypeScript
Raw Normal View History

2016-06-24 04:44:44 -06:00
function shuffle(a) {
2021-07-31 13:09:02 -06:00
let j, x, i;
2016-06-24 04:44:44 -06:00
for (i = a.length; i; i -= 1) {
j = Math.floor(Math.random() * i);
x = a[i - 1];
a[i - 1] = a[j];
a[j] = x;
}
}
2021-07-31 13:09:02 -06:00
const list = [
2017-07-15 15:48:25 -06:00
'awesome',
'excellent',
'greatJob',
'perfect',
'outstanding',
'wayToGo',
'yesYesYes',
'youreGoodAtThis',
'nailedIt',
2021-02-06 06:26:05 -07:00
'rightOn',
2016-06-24 04:44:44 -06:00
];
shuffle(list);
2021-07-31 13:09:02 -06:00
let it = 0;
2016-06-24 04:44:44 -06:00
2021-02-06 06:26:05 -07:00
module.exports = function () {
2016-06-24 05:45:46 -06:00
return list[it++ % list.length];
2016-06-24 04:44:44 -06:00
};