Hello Fabien,
> On 5 Aug 2017, at 12:15, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
>
>
> Hello Alik,
>
> I've done some math investigations, which consisted in spending one hour with Christian, a statistician colleague of
mine.He took an old book out of a shelf, opened it to page 550 (roughly in the middle), and explained to me how to
builda real zipfian distribution random generator.
>
> The iterative method is for parameter a>1 and works for unbounded values. It is simple to add a bound. In practice
theiterative method is quite effective, i.e. number of iterations is typically small, at least if the bound is large
andif parameter a is not too close to 1.
> I've attached a python3 script which implements the algorithm. It looks like magic. Beware that a C implementation
shouldtake care of float and int overflows.
>
Thank you for the script. I will rewrite it to C and add to the patch soon.
—
Thanks and Regards,
Alik Khilazhev
Postgres Professional:
http://www.postgrespro.com
The Russian Postgres Company