mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Create random.js
This commit is contained in:
parent
f4fbd2ad1c
commit
ea20382f62
16
lib/random.js
Normal file
16
lib/random.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
function getInt(min, max) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
function one(arr) {
|
||||
return arr[range(0, arr.length - 1)];
|
||||
}
|
||||
|
||||
exports.getInt = getInt;
|
||||
exports.one = one;
|
||||
|
||||
exports.VERSIONINFO = "Random Module (random.js) version 0.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
Loading…
Reference in New Issue
Block a user