01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
package algs11;
import stdlib.*;
public class XDrawArray {
  public static void main (String[] args) {
    int N = 50;
    double[] a = new double[N];
    for (int i = 0; i < N; i++)
      a[i] = StdRandom.random ();
    for (int i = 0; i < N; i++) {
      double x = 1.0 * i / N;
      double y = a[i] / 2.0;
      double rw = 0.25 / N;
      double rh = a[i] / 2.0;
      StdDraw.filledRectangle (x, y, rw, rh);
    }
  }
}