Help the world stop coronavirus! Stay home!

Prev Next

Java / Operators

Write a Java program to generate a random number between 0 to 99.

The below program uses the current time in milliseconds and apply modulo operator to pick a random number between 0 to 99.

public class RandomNumberGen {
	public static void main(String[] args) {
		long start_time = System.currentTimeMillis();

		System.out.println(start_time % 100);

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...


Comments & Discussions