4 ms·
Cool project! Might be nice to include a random permutation method.
by paddw 3y ago
Cool project! Might be nice to include a random permutation method.
- tantalor 3y agointSequence(min, max, engine) Returns an array with all integers between min and max in random order.
- shhsshs 3y agoconst randomPermutation = arr => intSequence(0, arr.length - 1).map(i => arr[i]) console.log(randomPermutation(['a', 'b', 'c'])
- chriscavs 3y agoI believe sequence will accomplish what you're looking for here const randomSeq = sequence([1,2,3]) // could return [3,1,2], [2,3,1], etc.