แก้วงเล็บ

This commit is contained in:
Pitchaya Boonsarngsuk
2018-03-22 15:48:30 +00:00
parent d31951fa85
commit f316d2755a
3 changed files with 6 additions and 6 deletions

View File

@@ -52,7 +52,7 @@ export default function() {
let u = 2 * Math.random() - 1;
let v = 2 * Math.random() - 1;
let r = u * u + v * v;
if (r == 0 || r > 1) return gaussRandom();
if (r == 0 || r > 1) {return gaussRandom();}
return u * Math.sqrt(-2 * Math.log(r) / r);
}
@@ -74,7 +74,7 @@ export default function() {
* @return {Float64Array} - array of zeros with length n.
*/
function zeros(n) {
if (typeof(n) === 'undefined' || isNaN(n)) {
if (typeof n === 'undefined' || isNaN(n)) {
return [];
}
return new Float64Array(n); // typed arrays are faster