UNPKG

randomcryp

Version:

A cryptographically secure, feature rich, zero dependency and browser friendly random number generator library.

7 lines (6 loc) 297 B
/** * Generates `true` with a given probability `p` and `false` with probability `1-p`. * @throws {RangeError} If `p` is not in range `[0, 1]`. * @example probability(0.8); // returns true 80% of the time and false 20% of the time. */ export declare const probability: (p: number) => boolean;