/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sumulationsecondlab.New;

import javax.swing.*;
import java.util.Random;

public class TestRandom {

    public static void main(String args[]) {
        Random r = new Random();
        int n, frequency[] = new int[10];
        r.setSeed(1000);
        // generate 1000 numbers
        for (int i = 1; i <= 1000; i++) {
            n = r.nextInt(10);
            ++frequency[n];
        }

        String output = "Number\tFrequency";

        for (n = 0; n < frequency.length; n++) {
            output += "\n" + n + "\t" + frequency[n];
        }

        JTextArea outputArea = new JTextArea();
        outputArea.setText(output);

        JOptionPane.showMessageDialog(null, outputArea, "Random number b/n 0 and 10", JOptionPane.INFORMATION_MESSAGE);

        System.exit(0);
    }
}

