Skip to main content
Module

x/simplestatistics/index.js>shuffle

simple statistics for node & browser javascript
Go to Latest
function shuffle
import { shuffle } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

A Fisher-Yates shuffle is a fast way to create a random permutation of a finite set. This is a function around shuffle_in_place that adds the guarantee that it will not modify its input.

Examples

var shuffled = shuffle([1, 2, 3, 4]); shuffled; // = [2, 3, 1, 4] or any other random permutation

Parameters

x

sample of 0 or more numbers

randomSource