Define flip(p) that returns True with probability p and False with probability (1-p).

Updated: