@unglish/word-generator
Version:
A simple generator for creating unglish words.
15 lines • 551 B
TypeScript
/**
* Returns a weighted random option, given an array of options with weights.
* ```
* let color = getWeightedOption([
* ["red", 10],
* ["green", 30],
* ["blue", 50],
* ]);
* ```
* Curtesy Mark Knol, T: @mknol (sourced from: https://github.com/liamegan/fxhash-helpers/blob/main/src/index.js)
* @param options - options in the format of [ [ string: optionName, int: optionNumber ] ]
*/
declare const getWeightedOption: <T>(options: [T, number][]) => T;
export default getWeightedOption;
//# sourceMappingURL=getWeightedOption.d.ts.map