Continue on Game view
[vchess.git] / server / utils / tokenGenerator.js
CommitLineData
badeb466 1function randString()
0bd5933d 2{
badeb466
BA
3 return Math.random().toString(36).substr(2); // remove `0.`
4}
0bd5933d 5
badeb466
BA
6module.exports = function(tlen)
7{
8 let res = "";
9 let nbRands = Math.ceil(tlen/10); //10 = min length of a rand() string
10 for (let i = 0; i < nbRands; i++)
11 res += randString();
12 return res.substr(0, tlen);
0bd5933d 13}