lundi 21 décembre 2015

how to generate unbiased random numbers in php

We have pseudo random numbers which are normally distributed. Now numbers closer to mean(mid) have much greater probability than the numbers closer to edges(biased generation). My personal experience is that to generate 100,000 unique numbers in a range of (1 - 100 000) using mt-rand(1,100000) we have to call this function for about 1.15 million times.

Can I do some standardization such that this no 1.15 million can be reduced and all of my domain gets equal probability(unbiased generation)?

I can't use php 7's random_Int() as it takes a lot of time. My target is to reduce running time.




Aucun commentaire:

Enregistrer un commentaire