-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData.java
More file actions
39 lines (37 loc) · 1.18 KB
/
Data.java
File metadata and controls
39 lines (37 loc) · 1.18 KB
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
31
32
33
34
35
36
37
38
39
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Data {
public static void main(String[] args) {
int q = 1000000;
BufferedWriter bw = null;
FileWriter fw = null;
try {
fw = new FileWriter(args[0]);
bw = new BufferedWriter(fw);
String firstLine = new String(q + "\n");
bw.write(firstLine);
for (int i = 0; i < q; i++) {
bw.write(Integer.toString(getRandInt(1, Integer.MAX_VALUE)) + Integer.toString(getRandInt(1, Integer.MAX_VALUE)));
bw.write(Integer.toString(getRandInt(1, Integer.MAX_VALUE)) + Integer.toString(getRandInt(1, Integer.MAX_VALUE)));
bw.write(Integer.toString(getRandInt(1, Integer.MAX_VALUE)) + Integer.toString(getRandInt(1, Integer.MAX_VALUE)) + "\n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bw != null)
bw.close();
if (fw != null)
fw.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
public static int getRandInt(int min, int max) {
return (int) (Math.random() * max + min);
}
}