Revise server code + a few fixes in trnalsations and ComputerGame
[vchess.git] / server / utils / tokenGenerator.js
1 function randString()
2 {
3 return Math.random().toString(36).substr(2); // remove `0.`
4 }
5
6 module.exports = function(tokenLength)
7 {
8 let res = "";
9 // 10 = min length of a rand() string
10 let nbRands = Math.ceil(tokenLength/10);
11 for (let i = 0; i < nbRands; i++)
12 res += randString();
13 return res.substr(0, tokenLength);
14 }