import java.awt.*;
import java.applet.*;
import java.lang.*;

public class Normal extends Applet
{
      Graphics  bG;
      Image     bI;
      int       stopswitch = 0;

      public void init()
      {
           bI = createImage(this.size().width, this.size().height);
           bG = bI.getGraphics();
      }

      public void update(Graphics g)
      {
           paint(g);
      }

      public void paint(Graphics g)
      {
           int     count[] = new int[201];
           int     x, y, ny, i, k;
           int     steps = 99;

           stopswitch = 0;

           for (i = 0; i < 201; i = i + 1)
              count[i] = 0;

           bG.setColor(new Color(0, 0, 0));
           bG.fillRect(0, 0, 601, 201);

           bG.setColor(new Color(160, 80,40));
           bG.fillRect(400, 0, 10, 201);

           for (k = 0; k + stopswitch < 1000; k = k + 1)
           { 
               bG.setColor(new Color(0, 0, 255));
               bG.fillRect(0, 0, 400, 201);
 
               bG.setColor(new Color(255, 255, 0));

               x = 0;
               y = 0;
               for (x = 0; x < 399; x = x + 2)
               {   ny = (int) ( 
                         java.lang.Math.floor(5 * java.lang.Math.random()) - 2);
                   bG.drawLine(x, y + 100, x + 1, y + ny + 100);
                   y = y + ny;
               }
            
           y = java.lang.Math.min(y, 100);
           y = java.lang.Math.max(y, -100);
           count[y + 100] = count[y + 100] + 4;
           bG.setColor(new Color(255, 255, 255));
           bG.fillRect(406 + count[y + 100], y + 99, 4, 3);
           g.drawImage(bI, 0, 0, this);
           }
      }

      public void stop()
      {    stopswitch = 1000;
      }
}


Copyright c 1997 by Frank Wattenberg, Department of Mathematics, Montana State University, Bozeman, MT 59717