logp_false = logp([False]*len(q0))
p_true = exp(logp_true)
p_false = exp(logp_false)
// Stochastically set value according to relative
// probabilities of True and False
return (random(len(q0)) < p_true / (p_true + p_false)).astype(int)
After Change
p_jump = 1.-.5**self.scaling
rand_array = random(q0.shape)
q = copy(q0)
// Locations where switches occur, according to p_jump
switch_locs = where(rand_array<p_jump)
q[switch_locs] = True - q[switch_locs]
q_new = metrop_select(logp(q) - logp(q0), q, q0)
return q_new