fiction-word
Version:
A random word generator.
11 lines (10 loc) • 424 B
TypeScript
/**
* @description Computes the cumulative distribution of word lengths.
* @returns An array of cumulative probabilities for each word length.
*/
export declare function generateDistribution(mode?: "dictionary" | "corpus"): [number, number][];
/**
* Sample a word length from the distribution.
* @returns A random word length.
*/
export declare function getRandomWordLength(distribution?: [number, number][]): number;