Number generator in time

94 Views Asked by At

:) I need a program in java, what will generate random numbers in time. Rage of random numbers is 1-100. If there will be sequence of numbers 1,50 and 95, program will stop and in the output must be written count of all random generated numbers, start and end time of generating numbers.

I need this program for my school assignment, and Im not so good at it :( If can someone help me, it would be great.

Thanx and have a nice day :)

1

There are 1 best solutions below

1
On

I made you a quick program that will generate a random amount of numbers up to 1000. The range of numbers printed are 1-100.

import java.util.Random;

        Random number = new Random();
        int y = number.nextInt(1000);
        System.out.println("random numbers:");
        for (int i = 1; i <= y; i++) {
            int x = 1 + (int) (Math.random() * 100);
            System.out.println(x);

        }

    }
}