/**
nowjava.com - 时 代 Java
**/
import java.util.Random;
public class Main {
public static void main(String[] args) {
// Create a new instance of the Random class
Random random = new Random();
System.out.println("Random: " + random);
// Generates a random Integer
int myInt = random.nextInt();
/**
来 自 时代Java公众号 - N o w J a v a . c o m
**/
System.out.println("Random int: " + myInt);
// Generates a random Double value
double myDouble = random.nextDouble();
System.out.println("Random double: " + myDouble);
// Generates a random float
float myFloat = random.nextFloat();
System.out.println("Random float: " + myFloat);
// Generates a random Gaussian double
// mean 0.0 and standard deviation 1.0
double gausDouble = random.nextGaussian();
System.out.println("Random Gaussian double: " + gausDouble);
// Generates a random Long
long myLong = random.nextLong();
System.out.println("Random long: " + myLong);
// Generates a random boolean
/**代码未完, 请加载全部代码(NowJava.com).**/