lundi 16 octobre 2017

Non-uniform (biased towards a value) random numbers in JavaScript

I am aware that random integers can be generated in JavaScript like this:

function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

But what I want is a set of random numbers that are biased towards a specific value.

As an example, if my specific center value is 200, I want a set of random numbers that has a large range, but mostly around 200.




Aucun commentaire:

Enregistrer un commentaire