Utils#chanceRoll()

chanceRoll(chance) → {boolean}

Generate a random bool result based on the chance value.

Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.

Parameters
Name Type Description
chance number

The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%).

Returns
boolean -

True if the roll passed, or false otherwise.

Source code: utils/Utils.js (Line 91)
doc_phaser
2017-02-14 11:19:01
Comments
Leave a Comment

Please login to continue.