001package algs11; 002import stdlib.*; 003public class XDrawArray { 004 public static void main (String[] args) { 005 int N = 50; 006 double[] a = new double[N]; 007 for (int i = 0; i < N; i++) 008 a[i] = StdRandom.random (); 009 for (int i = 0; i < N; i++) { 010 double x = 1.0 * i / N; 011 double y = a[i] / 2.0; 012 double rw = 0.25 / N; 013 double rh = a[i] / 2.0; 014 StdDraw.filledRectangle (x, y, rw, rh); 015 } 016 } 017}