samedi 19 décembre 2015

how to generate unbiased random numbers in php

Basically, we have pseudo random numbers which are normally distributed. Now no's closer to mean(mid) have much greater probability than the no's closer to edges(biased generation). My personal experience is that to generate 100,000 unique no's in a range of (1 - 1 Lac) using mt-rand(1,100000) we have to call this function for about 11.5 lac times. Now can I do some standardization such that this no 11.5 lac 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 basic problem is to reduce running time here.




Aucun commentaire:

Enregistrer un commentaire