You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
simpleRandomString = function (size) {
let ret = '';
const ids = 'abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; // <- this fails on Z
for (let i = 0; i < size; i++) {
let rand = Math.random ();
console.log ('1 rand', rand);
let numb = rand * ids.length;
console.log ('2 numb', numb);
let pos = Math.floor (numb);
console.log ('3 pos', pos, typeof pos, ids.length);
let id = ids[pos]; // <- RANDOM seg faults here
console.log ('4 id', id);
ret += id;
console.log ('5 ret', ret);
}
return ret;
};
for (let i = 100000; i >= 0; i--) { // loop de loop
let rand = simpleRandomString (2); // call the troublesome function
console.log ('iters left', i, ' word:', rand, '\n');
}
console.log ('success');
Activity
john-yan commentedon Aug 17, 2018
Create PR: #22375
gdams commentedon Aug 26, 2018
This got landed in: 5294919. Closing