-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKdTreeGenerator.java
More file actions
30 lines (27 loc) · 902 Bytes
/
KdTreeGenerator.java
File metadata and controls
30 lines (27 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/******************************************************************************
* Compilation: javac KdTreeGenerator.java
* Execution: java KdTreeGenerator n
* Dependencies:
*
* Creates n random points in the unit square and print to standard output.
*
* % java KdTreeGenerator 5
* 0.195080 0.938777
* 0.351415 0.017802
* 0.556719 0.841373
* 0.183384 0.636701
* 0.649952 0.237188
*
******************************************************************************/
import edu.princeton.cs.algs4.StdRandom;
import edu.princeton.cs.algs4.StdOut;
public class KdTreeGenerator {
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
for (int i = 0; i < n; i++) {
double x = StdRandom.uniform(0.0, 1.0);
double y = StdRandom.uniform(0.0, 1.0);
StdOut.printf("%8.6f %8.6f\n", x, y);
}
}
}