function walker_1d_bins ( n, m )

%% WALKER_1D_BINS shows the location at step K of M random walks.
%
  x = zeros ( m, 1 );
  pos = -n:n;

  for steps = 0 : 100
%
%  Count how many X values are at -N, -N+1, ..., N-1, N.
%
    for i = 1 : 2 * n + 1
      xcount(i) = sum ( x == pos(i) );
    end
%
%  Make a plot showing each value, and the number of walkers there.
%
    clf
    hold on
    bar ( pos, xcount );
    str = sprintf ( 'Step %d', steps );
    title ( str );
    grid on
    if ( steps == 50 )
      print ( '-djpeg', 'walker_1d_bins.jpg' );
    end
    pause
%
%  Overlay the normal curve.
%
    y = @(x) 2*m*exp(-x.^2/2/steps)/sqrt(2*pi*steps);
    plot ( pos, y ( pos ), 'r-', 'LineWidth', 3 );
    if ( steps == 50 )
      print ( '-djpeg', 'walker_1d_bins+normal.jpg' );
    end
    pause
%
%  Now let each walker take one more step.
%
    for j = 1 : m
      i = randi ( [ 1, 2 ] );
      if ( i == 1 )
        x(j) = x(j) - 1;
      else
        x(j) = x(j) + 1;
      end
    end

  end

  return
end
