mercredi 25 avril 2018

Stuck inside nextGaussian() method

i have a break point directly after a call to nextGaussian() method in eclipse. the code takes forever to run and when i paused it it shows that it's in the StrictMath.log(double) inside of RandomPlus(Random).nextGaussian() which is inside of RandomPLus.normalRand(double mean, double std). below is my random plus code:

public class RandomPlus extends Random{
    private static final long serialVersionUID = 1L;

    public double NormalRand(double mean, double standardDeviation) {
        return mean + (this.nextGaussian() * standardDeviation);
    }

    public boolean draw(double probability) {
        return this.nextDouble() < probability;
    }
}

The only thing i can think of is that i call this medthod ~ 100.000 times with everytime creating a new instance of it.




Aucun commentaire:

Enregistrer un commentaire