From 92e4345c0e1782ffc83cdb2a924fec6f4d863ba4 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Mon, 27 Apr 2020 10:23:44 +0100 Subject: [PATCH] Should be between -pi, pi #5075 --- src/math/angle/Random.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/math/angle/Random.js b/src/math/angle/Random.js index c69635452..3839fb422 100644 --- a/src/math/angle/Random.js +++ b/src/math/angle/Random.js @@ -1,8 +1,15 @@ +/** + * @author Richard Davey + * @author @samme + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + var FloatBetween = require('../FloatBetween'); var CONST = require('../const'); /** - * Returns a random angle in the range [0, 2pi]. + * Returns a random angle in the range [-pi, pi]. * * @function Phaser.Math.Angle.Random * @since 3.23.0 @@ -11,7 +18,7 @@ var CONST = require('../const'); */ var Random = function () { - return FloatBetween(0, CONST.PI2); + return FloatBetween(-Math.PI, Math.PI); }; module.exports = Random;