Added RandomDataGenerator.sign (returns -1 or +1)

This commit is contained in:
Taylan Kasap 2016-02-07 14:19:28 +02:00
parent 1465d18d6b
commit 1310daa9af

View file

@ -268,6 +268,18 @@ Phaser.RandomDataGenerator.prototype = {
}, },
/**
* Returns a sign to be used with multiplication operator.
*
* @method Phaser.RandomDataGenerator#sign
* @return {number} -1 or +1.
*/
sign: function () {
return this.pick([-1, 1]);
},
/** /**
* Returns a random member of `array`, favoring the earlier entries. * Returns a random member of `array`, favoring the earlier entries.
* *