Update rand.js

This commit is contained in:
Namhyeon Go 2022-06-28 12:59:35 +09:00 committed by GitHub
parent f0e5197e92
commit a59d5210d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,10 @@ function getInt(min, max) {
return Math.floor(randomize() * (max - min + 1)) + min; return Math.floor(randomize() * (max - min + 1)) + min;
} }
function getSeed() {
return getInt(10000000, 99999999);
}
function one(arr) { function one(arr) {
return arr[getInt(0, arr.length - 1)]; return arr[getInt(0, arr.length - 1)];
} }
@ -105,6 +109,7 @@ function discardOne(arr, filename) {
exports.randomize = randomize; exports.randomize = randomize;
exports.getInt = getInt; exports.getInt = getInt;
exports.getSeed = getSeed;
exports.one = one; exports.one = one;
exports.makeString = makeString; exports.makeString = makeString;
exports.uuidv4 = uuidv4; exports.uuidv4 = uuidv4;
@ -114,6 +119,6 @@ exports.sample = sample;
exports.discardOne = discardOne; exports.discardOne = discardOne;
exports.discardCallback = discardCallback; exports.discardCallback = discardCallback;
exports.VERSIONINFO = "Random Module (rand.js) version 0.5"; exports.VERSIONINFO = "Random Module (rand.js) version 0.6";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;