function x = coin(n)
% Returns a vector x of n random bits (zero or one)
% Input
%   n : number of values to be returned
% Output
%   x : row vector of n random bits (zero or one)
% Usage
%   x = coin(100)
% Author
%   Jose M Soler. Nov.2010

% rand(1,n) returns random numbers between 0 and 1
% rand>0.5 returns 1 if rand is larger than 0.5, and 0 otherwise

x = (rand(1,n) < 0.5);

end