Function nextBoolean

  • Generates a random boolean.

    The ratio param is used to determine the chance of the boolean being true or false.

    For instance:

    • If ratio is .5, the chance of being true or false is 50%.
    • If ratio is .1, the chance of being true is 10%, and of being false is 90%.
    • If ratio is .9, the chance of being true is 90%, and of being false is 10%.
    • If ratio is 1 or greater, the chance of being true is 100%.
    • If ratio is 0 or lower, the chance of being true is 0%.

    Returns

    A random boolean.

    Parameters

    • ratio: number = .5

      The ratio (between 0 and 1) which the boolean is determined to be true or false. The greater the number, the greater the chance of being true.

    Returns boolean

Generated using TypeDoc