Skip to content

Commit 92e4345

Browse files
committed
Should be between -pi, pi phaserjs#5075
1 parent b3128f9 commit 92e4345

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/math/angle/Random.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @author @samme
4+
* @copyright 2020 Photon Storm Ltd.
5+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
6+
*/
7+
18
var FloatBetween = require('../FloatBetween');
29
var CONST = require('../const');
310

411
/**
5-
* Returns a random angle in the range [0, 2pi].
12+
* Returns a random angle in the range [-pi, pi].
613
*
714
* @function Phaser.Math.Angle.Random
815
* @since 3.23.0
@@ -11,7 +18,7 @@ var CONST = require('../const');
1118
*/
1219
var Random = function ()
1320
{
14-
return FloatBetween(0, CONST.PI2);
21+
return FloatBetween(-Math.PI, Math.PI);
1522
};
1623

1724
module.exports = Random;

0 commit comments

Comments
 (0)