@extra-array/shuffle-update
v2.3.2
Published
Rearranges values in arbitrary order.
Downloads
17
Maintainers
Keywords
Readme
Rearranges values in arbitrary order.
This is part of package extra-array.
array.shuffle$(x, [n]);
// x: an array (updated)
// n: random seed 0->1
// --> x
const array = require('extra-array');
var x = [1, 2, 3, 4, 5];
array.shuffle(x);
// [ 1, 5, 4, 3, 2 ]
x;
// [ 1, 5, 4, 3, 2 ]
var x = [1, 2, 3, 4, 5];
array.shuffle(x, 0.3);
// [ 4, 5, 2, 3, 1 ]
var x = [1, 2, 3, 4, 5];
array.shuffle(x, 0.3);
// [ 4, 5, 2, 3, 1 ]