mardi 9 juillet 2019

How to generate an inclusively bounded Pareto random integer from JavaScript's Math.random

From wikipedia:

enter image description here

As you can see, this formula is based on using a random number uniformly distributed on (0,1) and produces fractions. Math.random in JavaScript produces numbers on [0,1).

What formula (or better yet, code) would allow me to generate inclusively bounded random Pareto integer using Math.random?

I'm looking for this kind of API:

function getRandomParetoIntInclusive(min, max, alpha = 1)




Aucun commentaire:

Enregistrer un commentaire