mercredi 27 septembre 2017

I need Half Gauss Bell in Javascript

I have created a function that returns a Gaussian number between the minimum and the maximum that you put. The random subfunction gives a Gaussian number between 0 and 1, usually 0.5. I want to know if there is any way that the number tends to be 0. As if it were half gauss bell

function gaussianNumber(min, max, strength) {

function random(){
    var rand = 0;
    for (var i = 0; i < strength; i++) {
        rand += Math.random();
    }
    return rand / strength;
}

return Math.floor(random()*(max+1-min)+min);

}




Aucun commentaire:

Enregistrer un commentaire