mirror of
https://github.com/wassname/phaser.git
synced 2026-10-08 12:19:14 +08:00
RandomDataGenerator.integerInRange(min, max) now includes both min and max within its range (#501)
This commit is contained in:
1 parent
52118be088
commit
0eb23d4b11
3 files changed
+44
-2
No files matched your search
@@ -154,14 +154,15 @@ Phaser.RandomDataGenerator.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a random integer between min and max.
|
||||
* Returns a random integer between and including min and max.
|
||||
*
|
||||
* @method Phaser.RandomDataGenerator#integerInRange
|
||||
* @param {number} min - The minimum value in the range.
|
||||
* @param {number} max - The maximum value in the range.
|
||||
* @return {number} A random number between min and max.
|
||||
*/
|
||||
integerInRange: function (min, max) {
|
||||
return Math.floor(this.realInRange(min, max));
|
||||
return Math.round(this.realInRange(min, max));
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user