import java.util.*;
public class generator {
private final int MIN_N = 1;
private final int MAX_N = 10000;
private final int MIN_W = 0;
private final int MAX_W = 207;
private final int MIN_D = 0;
private final int MAX_D = 960;
private int n;
private int[] w;
private double[] d;
private Random random;
private int randomIntBetween(int lower, int upper) {
return lower + random.nextInt(upper - lower + 1);
}
private double randomDoubleBetween(double lower, double upper) {
return lower + random.nextDouble() * (upper - lower);
}
private void generateRandom() {
for (int i = 0; i < n; i++) {
w[i] = randomIntBetween(MIN_W, MAX_W);
d[i] = randomDoubleBetween(MIN_D, MAX_D);
}
}
private void generateGaussian() {
for (int i = 0; i < n; i++) {
do {
w[i] = randomIntBetween(MIN_W, MAX_W);
d[i] = random.nextGaussian() * MAX_D / 4 + MAX_D / 2;
} while(d[i] <= MIN_D || d[i] >= MAX_D);
}
}
private void shuffle() {
for (int i = 0; i < n - 1; i++) {
int j = randomIntBetween(i, n - 1);
int ww = w[j];
w[j] = w[i];
w[i] = ww;
double dd = d[j];
d[j] = d[i];
d[i] = dd;
}
}
private void generateMixed() {
int ind = 0;
while (ind < n / 2) {
int wrap = randomIntBetween(MIN_W, MAX_W);
double dist = randomDoubleBetween(MIN_D, MAX_D - 1);
for (int delta = 0; delta < 10; delta++)
{
if (ind < n)
{
w[ind] = wrap;
d[ind] = dist + delta / 10.0;
ind++;
}
}
}
for (; ind < n; ind++)
{
w[ind] = randomIntBetween(MIN_W, MAX_W);
d[ind] = randomDoubleBetween(MIN_D, MAX_D);
}
shuffle();
}
private void generate(long seed) {
if (seed == 1) { // sample case
n = 5;
w = new int[] { 7, 47, 47, 74, 77};
d = new double[] {400.0, 410.0, 404.0, 777.7, 770.0};
return;
}
random = new Random(seed);
n = randomIntBetween(MIN_N, MAX_N);
w = new int[n];
d = new double[n];
int type = randomIntBetween(0, 2);
switch (type) {
case 0:
generateRandom();
break;
case 1:
generateGaussian();
break;
case 2:
generateMixed();
break;
}
}
private void print() {
System.out.println(n);
for (int i = 0; i < n; i++)
System.out.println("" + w[i] + " " + d[i]);
}
public static void main(String args[]) {
long seed = 1L;
if (args.length == 1) seed = Long.parseLong(args[0]);
generator g = new generator();
g.generate(seed);
g.print();
}
}