function n = twovaluesample(x, H) mu = 2^(1/H); p = (mu-2)/(x-2); if rand < 2*(1-p)/mu, n = 2; else n = x; end