Some advances. TODO: test board.js, and then game.js, and then implement room.js
[vchess.git] / utils / tokenGenerator.js
1 module.exports =
2 {
3 rand: function() {
4 return Math.random().toString(36).substr(2); // remove `0.`
5 },
6
7 generate: function(tlen) {
8 var res = "";
9 var nbRands = Math.ceil(tlen/10); //10 = min length of a rand() string
10 for (var i = 0; i < nbRands; i++)
11 res += TokenGen.rand();
12 return res.substr(0, tlen);
13 },
14 }