/** GeneratePoints.java - Generate a list of random ordered pairs that * can be used as input to the closest-pair problem. * How to run: if you type java GeneratePoints then you should * get n ordered pairs, each in the range 0,0 to 4n-1,4n-1. * I wanted the range to be 4n in order to spread out the points. */ import java.util.Random; public class GeneratePoints { public static void main(String [] args) { int howMany = Integer.parseInt(args[0]); Random gen = new Random(); for (int i = 0; i < howMany; ++i) { int x = gen.nextInt(4 * howMany); int y = gen.nextInt(4 * howMany); System.out.printf("%d, %d\n", x, y); } } }