Skip to content

Function: chance()

ts
function chance(rate: number, base?: number): boolean;

Get math random based chance to happen by base of provided parameter. By default, calculates 'rate' of 100.

Parameters

ParameterTypeDefault valueDescription
ratenumberundefinedChance to happen (0 - base).
basenumber100Chance base.

Returns

boolean

Whether thing should happen.