Skip to content

Commit

Permalink
Update random.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cardinal9999 authored Sep 1, 2021
1 parent 66d5fa1 commit a930806
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions javascript/random.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
var cryptoObj;
cryptoObj = window.crypto || window.msCrypto;


export function randbelow(max) {
array = new Uint16Array(4);
cryptoObj.getRandomValues(array);
eeeeee = array[0] * array[1] * array[2];
return eeeeee % max;
}
function randbelow(max) {
array = new Uint16Array(7);
cryptoObj.getRandomValues(array);
N = array[0] + array[1];
O = array[2] * array[5];
return (N * O) % max
}

export function randint(min, max) {
x = max - min;
distance = randbelow(x);
return max - distance;
x = max - min;
distance = randbelow(x);
return max - distance;
}

export function choice(group) {
return group[randbelow(group.length)];
return group[randbelow(group.length)];
}

export function alphanumeric(length) {
Expand Down

0 comments on commit a930806

Please sign in to comment.