function path=binomial(omega)
% generates a 52-step binomial path for a given sample in [0,1)
% N.B.: upper limit is actually 1-2^-52=0.9999999999999997...
    omega=uint64(omega*2^52);
    path=dec2base(omega,2);
    path=sscanf(path,'%1e');
    path=[zeros(52-length(path),1);path];
    path=[0;cumsum(2*path-1)];

% plot(cell2mat(arrayfun(@binomial,rand(1,20),'UniformOutput',false)))
% last=@(path)path(53);
% hist(arrayfun(@(omega)last(binomial(omega)),rand(1000,1)))
% mean(arrayfun(@(omega)last(binomial(omega)),rand(1000,1)))
% var(arrayfun(@(omega)last(binomial(omega)),rand(1000,1)))
% hist(arrayfun(@(omega)min(binomial(omega)),rand(1000,1)))
% range=@(x)max(x)-min(x);
