mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 00:45:14 +00:00
Update rand.js
This commit is contained in:
parent
6a13d9437b
commit
b587b31485
|
@ -71,6 +71,10 @@ function rotate(arr, i) {
|
||||||
return arr[i % arr.length];
|
return arr[i % arr.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sample(arr, length) {
|
||||||
|
return shuffle(arr).slice(0, length);
|
||||||
|
}
|
||||||
|
|
||||||
exports.randomize = randomize;
|
exports.randomize = randomize;
|
||||||
exports.getInt = getInt;
|
exports.getInt = getInt;
|
||||||
exports.one = one;
|
exports.one = one;
|
||||||
|
@ -78,7 +82,8 @@ exports.makeString = makeString;
|
||||||
exports.uuidv4 = uuidv4;
|
exports.uuidv4 = uuidv4;
|
||||||
exports.shuffle = shuffle;
|
exports.shuffle = shuffle;
|
||||||
exports.rotate = rotate;
|
exports.rotate = rotate;
|
||||||
|
exports.sample = sample;
|
||||||
|
|
||||||
exports.VERSIONINFO = "Random Module (rand.js) version 0.3";
|
exports.VERSIONINFO = "Random Module (rand.js) version 0.4";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user