Skip to main content
Module

x/simplestatistics/index.js>sampleWithReplacement

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

Sampling with replacement is a type of sampling that allows the same item to be picked out of a population more than once.

Examples

var values = [1, 2, 3, 4]; sampleWithReplacement(values, 2); // returns 2 random values, like [2, 4];

Parameters

x

an array of any kind of value

n

count of how many elements to take

randomSource