Algorithm works with theta less than 1. The only problem here is thattheta can not be 1, because of next line of codecell->alpha = 1. / (1 - theta); That’s why I put such restriction. Now I see 2 possible solutions for that: 1) Exclude 1, and allow everything in range (0;+∞).

Yep.

2) Or just increase/decrease theta by very small number if it is 1.

Nope, this seems quite arbitrary.

I've executed scripts that you attached with different theta and numberof outcomes(not n, n remains the same = 100) and I found out that fortheta = 0.1 and big number of outcomes it gives distribution verysimilar to zipfian(for number of outcomes = 100 000, bias -6% to 8% inwhole range and for NOO = 1000 000, bias is -2% to 2%).

Ok, so you did not get the large bias for i=3. Strange.

By, number of outcomes(NOO) I mean how many times random_zipfian wascalled. For example: pgbench -f compte_bench.sql -t 100000 So, I thinkit works but works worse for small number of outcomes. And also we needto find optimal theta for better results.

Hmmm. I've run one million outcomes each time. I'll check on the next version. -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers