How to use 'randi' in MATLAB to generate equally probable samples which are either 0 or 1?
Generate random integer uniformly distributed between 1 or 2. Then you can shift it to your liking.
X=randi(2,size,1)-1