-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
91 lines (73 loc) · 1.68 KB
/
Main.java
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import java.io.PrintWriter;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int numKnownSamp = 10000;
int numAttribut = 1000;
int numClass = 10;
int numUnknown = 10000;
int min = 0;
int max = 10;
int minClass = 0;
int maxClass = numClass-1;
String minMax = "";
String knownC ="";
String unknownC = "";
PrintWriter writer;
try {
writer = new PrintWriter("small12345.txt", "UTF-8");
writer.println(numKnownSamp+" "+numAttribut+" "+numClass+" "+numUnknown+" ");
for(int i = 0; i < numAttribut; i++)
{
if(i == 0)
{
minMax = min+" "+max;
}
else{
minMax = (minMax+" "+min+" "+max);
}
}
writer.println(minMax);
for(int i = 0; i< numKnownSamp; i++)
{
for(int j = 0; j<numAttribut;j++ )
{
if(j == 0)
{
knownC = ((int) (Math.random()*(maxClass - minClass+1))+minClass)+
" "+((int) (Math.random()*(max - min+1))+min);
}
else{
knownC = (knownC+" "+((int)(Math.random()*(max - min + 1))+min));
}
}
writer.println(knownC);
}
int unknownIndex = 1;
for(int i = 0; i< numUnknown; i++)
{
for(int j = 0; j<numAttribut;j++ )
{
if(j == 0)
{
unknownC = "P"+unknownIndex+
" "+((int) (Math.random()*(max - min+1))+min);
}
else{
unknownC = (unknownC+" "+((int)(Math.random()*(max - min + 1))+min));
}
}
unknownIndex++;
writer.println(unknownC);
}
writer.close();
System.out.println("Finished");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}