How do you produce a random 0 or 1 with random.rand
Is there a reason to specifically use np.random.rand? This function outputs a float as noted in the question and previous answers, and you would need thresholding to obtain an int.
scipy.stats.bernoulli(p) directly outputs a 1 with probability p and 0 with probability 1-p.
I'm trying to produce a 0 or 1 with numpy's random.rand.
np.random.rand() produces a random float between 0 and 1 but not just a 0 or a 1. 
Thank you.