import java.util.Random;
public class RandomDemo {
public static void main(String[] args) {
Random random = new Random();
System.out.println("boolean: " + random.nextBoolean());
System.out.println("int: " + random.nextInt());
System.out.println("double: " + random.nextDouble());
System.out.println("float: " + random.nextFloat());
System.out.println("int (scaled 0-99): " + random.nextInt(100));
}
}
No comments:
Post a Comment