Copyright Tristan Aubrey-Jones April 2007.
function f = brand(p);
% BRAND makes a random decision
% It generates a random number and if that
% number is less than the probability p, it returns
% 1 otherwise it returns 0.
%% Return
if rand <= p, f = 1;
else f = 0;
end