UNPKG

everyutil

Version:

A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.

9 lines (8 loc) 430 B
/** * Returns a random choice from the input choices array, using the given weights. * @author @dailker * @param {number[]} choices - The array of possible choices. * @param {number[]} weights - The array of weights corresponding to each choice. * @returns {number} A randomly selected value from choices, weighted by weights. */ export declare function weightedRandom(choices: number[], weights: number[]): number;