function action = e_greedy(Q, epsi) if rand > (1-epsi) action = ceil(rand*length(Q)); else [maxQ ,action] = max(Q); end