shuffle-obj-arrays
Shuffles the arrays of the given (object) map using shuffle-array.
Install
npm install shuffle-obj-arrays --save
Example
const shuffleObjArrays = ;
will return something like
API
shuffle-obj-arrays accepts the same options as shuffle, plus the option copyNonArrays
.
shuffleObjArrays( obj, [options] )
Randomizes the order of the elements in all arrays of the given object.
obj
{object} - The given object.options
{object} - Options, which may have:copy
{boolean} -true
to copy the given object. Defaults tofalse
.copyNonArrays
{boolean} -true
to copy non-array properties of the given object. Only works whencopy
istrue
. Defaults tofalse
.rng
{function} - Custom random number generator. Defaults toMath.random
.
Example:
const shuffleObjArrays = ; // Using a external pseudo-random number generator// https://github.com/davidbau/seedrandomconst seedrandom = ;const myRng = ; const options = copy: true rng: myRng; ;
will return something like
See also
- shuffle-array - Shuffles an array using Fisher-Yates algorithm and allows to pass a custom pseudo-random number generator (PRNG)
- seedrandom - Predictive PRNG
- one-wise - One-wise combinatorial testing for the arrays of the given object.