Skip to main content
The Deno 2 Release Candidate is here
Learn more
method WeightedRandomHelper.prototype.getWeightedValue
import { WeightedRandomHelper } from "https://deno.land/x/sptaki@1.2.0/helpers/WeightedRandomHelper.d.ts";

Choos an item from the passed in array based on the weightings of each

Parameters

itemArray: { [key: string]: unknown; } | ArrayLike<unknown>

Items and weights to use

Returns

Chosen item from array