Skip to content

Commit 1310daa

Browse files
committed
Added RandomDataGenerator.sign (returns -1 or +1)
1 parent 1465d18 commit 1310daa

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/math/RandomDataGenerator.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,18 @@ Phaser.RandomDataGenerator.prototype = {
268268

269269
},
270270

271+
/**
272+
* Returns a sign to be used with multiplication operator.
273+
*
274+
* @method Phaser.RandomDataGenerator#sign
275+
* @return {number} -1 or +1.
276+
*/
277+
sign: function () {
278+
279+
return this.pick([-1, 1]);
280+
281+
},
282+
271283
/**
272284
* Returns a random member of `array`, favoring the earlier entries.
273285
*

0 commit comments

Comments
 (0)