import java.util.*;
public class RandomDemo2 {
public static void main( String...args )
{
// create random object
Random randomno = new Random();
//Float value
System.out.println("Float value between 0.0 and 1.0: "+randomno.nextFloat());
//Double value
System.out.println("Double value between 0.0 and 1.0: "+randomno.nextDouble());
// check next Gaussian value
System.out.println("Next Gaussian value: " + randomno.nextGaussian());
}
}
Output:
public class RandomDemo2 {
public static void main( String...args )
{
// create random object
Random randomno = new Random();
//Float value
System.out.println("Float value between 0.0 and 1.0: "+randomno.nextFloat());
//Double value
System.out.println("Double value between 0.0 and 1.0: "+randomno.nextDouble());
// check next Gaussian value
System.out.println("Next Gaussian value: " + randomno.nextGaussian());
}
}
Output:
No comments:
Post a Comment