Shuffle generator
An array generator that randomly shuffles items from a given array.
const { age, letter, shuffle } = require("chance-generators");
expect(shuffle(["a", "b", "c"]).take(5), "to equal", [
["b", "c", "a"],
["a", "b", "c"],
["b", "c", "a"],
["b", "a", "c"],
["a", "c", "b"]
]);
If the items are generators, they will be used to generate the items:
expect(shuffle([age, letter, "wat"]).take(5), "to equal", [
["e", "wat", 53],
["wat", "e", 39],
[40, "wat", "w"],
["s", "wat", 49],
[52, "wat", "v"]
]);