java radnom

ht‮//:spt‬www.lautturi.com
java radnom

nextInt(n) generate a random int value between 0 (inclusive) and n (exclusive)

import java.util.*;

public class Lautturi {

	public static void main(String args[]) {
		int rndNumber;

		Random rnd = new Random(); //rnd is the name of the randomizer
		rndNumber = 1 + rnd.nextInt(10); //int between 1-10
		System.out.println(rndNumber);
	}
}
Created Time:2017-09-27 22:09:40  Author:lautturi