0.3.0 • Published 5 months ago
jshuffle v0.3.0
jshuffle
Random shuffling and sampling
Installation
npm install jshuffle
Usage
import { sample, shuffle, toSampled, toShuffled } from 'jshuffle';
// Shuffles an array in place.
console.log(shuffle([1, 2, 3, 4, 5]));
// Shuffles an array out of place.
console.log(toShuffled([1, 2, 3, 4, 5]));
// Chooses samples in place.
console.log(sample([1, 2, 3, 4, 5], 3));
// Chooses samples out of place.
console.log(toSampled([1, 2, 3, 4, 5], 3));