01: import java.util.Random;
02: 
03: /**
04:    This program computes square roots of random inputs.
05: */
06: public class RootApproximatorHarness3
07: {  
08:    public static void main(String[] args)
09:    {  
10:       final double SAMPLES = 100;
11:       Random generator = new Random();
12:       for (int i = 1; i <= SAMPLES; i++)
13:       {  
14:          // Generate random test value
15: 
16:          double x = 1000 * generator.nextDouble();
17:          RootApproximator r = new RootApproximator(x);
18:          double y = r.getRoot();
19:          System.out.println("square root of " + x
20:                + " = " + y);
21:       }
22:    }
23: }