UNPKG

730 BTypeScriptView Raw
1/** @module random */
2/**
3 * Random generator for boolean values.
4 *
5 * ### Example ###
6 *
7 * let value1 = RandomBoolean.nextBoolean(); // Possible result: true
8 * let value2 = RandomBoolean.chance(1,3); // Possible result: false
9 */
10export declare class RandomBoolean {
11 /**
12 * Calculates "chance" out of "max chances".
13 * Example: 1 chance out of 3 chances (or 33.3%)
14 *
15 * @param chance a chance proportional to maxChances.
16 * @param maxChances a maximum number of chances
17 */
18 static chance(chance: number, maxChances: number): boolean;
19 /**
20 * Generates a random boolean value.
21 *
22 * @returns a random boolean.
23 */
24 static nextBoolean(): boolean;
25}