2017-10-06 03:52:41 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @function Phaser.Math.RandomXYZW
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Math.Vector4} vec4 - [description]
|
|
|
|
* @param {float} [scale=1] - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Math.Vector4} [description]
|
|
|
|
*/
|
|
|
|
var RandomXYZW = function (vec4, scale)
|
2017-09-18 20:48:26 +00:00
|
|
|
{
|
|
|
|
if (scale === undefined) { scale = 1; }
|
|
|
|
|
|
|
|
// Not spherical; should fix this for more uniform distribution
|
2017-10-06 03:52:41 +00:00
|
|
|
vec4.x = (Math.random() * 2 - 1) * scale;
|
|
|
|
vec4.y = (Math.random() * 2 - 1) * scale;
|
|
|
|
vec4.z = (Math.random() * 2 - 1) * scale;
|
|
|
|
vec4.w = (Math.random() * 2 - 1) * scale;
|
2017-09-18 20:48:26 +00:00
|
|
|
|
2017-10-06 03:52:41 +00:00
|
|
|
return vec4;
|
2017-09-18 20:48:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = RandomXYZW;
|