import java.util.Random;

class GaussTest {

    public static void main(String[] args) {
	if (args.length < 1 || args.length > 2)
	    error("usage: GaussTest number_of_runs [seed]");

	// get number of runs
	int runs = 0;
	try {
	    runs = Integer.parseInt(args[0]);
	    if (runs < 1)
		throw new NumberFormatException(args[0]);
	} catch (NumberFormatException e) {
	    error("invalid number of runs");
	}

	// create random number generator, use seed if specified
	Random random = new Random();
	if (args.length >= 2) {
	    try {
		random.setSeed(Long.parseLong(args[1]));
	    } catch (NumberFormatException e) {
		error("invalid random number seed");
	    }
	}

	int[] bucket = new int[49];

	for (int i = 0; i < runs; i++) {
	    double x = random.nextGaussian();
	    int j = (int)Math.floor(x * 12.0 + 24.0);
	    if (j >= 0 && j < bucket.length)
		bucket[j]++;
	}

	int max = 0;
	for (int i = 0; i < bucket.length; i++) {
	    if (bucket[i] > max)
		max = bucket[i];
	}
	double normalizer;
	if (max < 64)
	    normalizer = 1.0;
	else
	    normalizer = 64.0 / max;

	for (int x = 0; x < bucket.length; x++) {
	    int y = (int)(bucket[x] * normalizer);
	    for (int j = 0; j < y; j++)
		System.out.print("*");
	    System.out.println();
	}
    }

    public static void error(String err) {
	System.err.println("GaussTest: " + err);
	System.exit(1); // non-zero argument means "not good"
    }
}
