function average = walker_1d_average ( n, m )

%% WALKER_1D_AVERAGE averages the length of a random walk on [-N,+N].
%
%  It is assumed the walker starts at 0, and randomly steps left or
%  right until reaching -N or +N.  The number of steps taken is the
%  length of the walk.
%
%  This program takes M random walks, and reports the average length.
%
  average = 0.0;

  for i = 1 : m
    track = walker_1d ( n );
    average = average + length ( track ) - 1;
  end

  average = average / m;

  return
end
