mirror of
https://github.com/photonstorm/phaser
synced 2024-12-25 12:33:38 +00:00
23 lines
698 B
JavaScript
23 lines
698 B
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
*/
|
|
|
|
/**
|
|
* Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive.
|
|
*
|
|
* @function Phaser.Math.FloatBetween
|
|
* @since 3.0.0
|
|
*
|
|
* @param {number} min - The lower bound for the float, inclusive.
|
|
* @param {number} max - The upper bound for the float exclusive.
|
|
*
|
|
* @return {number} A random float within the given range.
|
|
*/
|
|
var FloatBetween = function (min, max)
|
|
{
|
|
return Math.random() * (max - min) + min;
|
|
};
|
|
|
|
module.exports = FloatBetween;
|