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 173de26 commit 66d5fa1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions javascript/random.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
var cryptoObj;
cryptoObj = window.crypto || window.msCrypto;

var randbelow;
randbelow = function(max) {

export function randbelow(max) {
array = new Uint16Array(4);
cryptoObj.getRandomValues(array);
eeeeee = array[0] * array[1] * array[2];
return eeeeee % max;
}
var randint;
randint = function(min, max) {

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

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

export function alphanumeric(length) {
var str = "";
for(var i = 0; i < length; ++i){
chars = "qazwsxedcrfvtgbyhnujmikolpQAZWSXEDCRFVTGBYHNUJMIKOLP1234567890";
Expand Down

0 comments on commit 66d5fa1

Please sign in to comment.