function htsim(n, p) % Simulate the game of heads or tails, tossing n times % with probability p that heads comes up and plot Peter's cumulative % wins/losses flip=rand(1,n)