Returns 1 with probability p and 0 with probability 1-p. p must satisfy 0 < p < 1. By default p is equal to 0.5.