Skip to content

Commit

Permalink
Remove unused Utils.gaussianNoise()
Browse files Browse the repository at this point in the history
  • Loading branch information
alemart committed Jun 12, 2024
1 parent e27ea3c commit 0ede104
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,6 @@ export class Utils
return canvas;
}

/**
* Generates a random number with
* Gaussian distribution (mu, sigma)
* @param {number} mu mean
* @param {number} sigma standard deviation
* @returns {number} random number
*/
static gaussianNoise(mu = 0, sigma = 1)
{
// Box-Muller transformation
const TWO_PI = 2.0 * Math.PI;

let a, b = Math.random();
do { a = Math.random(); } while(a <= Number.EPSILON);
let z = Math.sqrt(-2 * Math.log(a)) * Math.sin(TWO_PI * b);

return z * sigma + mu;
}

/**
* Generate a 1D gaussian kernel with custom sigma
* Tip: use kernelSize >= (5 * sigma), kernelSize odd
Expand Down

0 comments on commit 0ede104

Please sign in to comment.