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