SUB Metropolis(x,delta,naccept) DECLARE DEF p LET xtrial = x + delta*(2*rnd - 1) LET w = p(xtrial)/p(x) IF rnd <= w then LET x = xtrial LET naccept = naccept + 1 ! number of acceptances END IF END SUB