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
// Generating entropy is faster than complex math operations, so we use the simplest way
8
+
constcharacterCount=chars.length;
9
+
constmaxValidSelector=(Math.floor(0x10000/characterCount)*characterCount)-1;// Using values above this will ruin distribution when using modular division
10
+
constentropyLength=2*Math.ceil(1.1*length);// Generating a bit more than required so chances we need more than one pass will be really low
11
+
letstring='';
12
+
letstringLength=0;
13
+
14
+
while(stringLength<length){// In case we had many bad values, which may happen for character sets of size above 0x8000 but close to it
0 commit comments