Skip to main content
Module

x/simplestatistics/index.js>shuffleInPlace

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

A Fisher-Yates shuffle in-place - which means that it will change the order of the original array by reference.

This is an algorithm that generates a random permutation of a set.

Examples

var x = [1, 2, 3, 4]; shuffleInPlace(x); // x is shuffled to a value like [2, 1, 4, 3]

Parameters

x

sample of one or more numbers

randomSource