Java by API/org.apache.commons.math/RandomUtils — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 17:43, 31 мая 2010
RandomUtils.nextDouble()
/*
Random double >>> 0.9454382405994292
Random float >>> 0.21482907
Random int >>> 1521164877
*/
import org.apache.rumons.lang.math.RandomUtils;
public class MathUtilsTrial {
public static void main(String[] args) {
// Random Value Generation
System.out.println("Random double >>> " + RandomUtils.nextDouble());
System.out.println("Random float >>> " + RandomUtils.nextFloat());
System.out.println("Random int >>> " + RandomUtils.nextInt());
}
}
RandomUtils.nextFloat()
/*
Random double >>> 0.9454382405994292
Random float >>> 0.21482907
Random int >>> 1521164877
*/
import org.apache.rumons.lang.math.RandomUtils;
public class MathUtilsTrial {
public static void main(String[] args) {
// Random Value Generation
System.out.println("Random double >>> " + RandomUtils.nextDouble());
System.out.println("Random float >>> " + RandomUtils.nextFloat());
System.out.println("Random int >>> " + RandomUtils.nextInt());
}
}
RandomUtils.nextInt()
/*
Random double >>> 0.9454382405994292
Random float >>> 0.21482907
Random int >>> 1521164877
*/
import org.apache.rumons.lang.math.RandomUtils;
public class MathUtilsTrial {
public static void main(String[] args) {
// Random Value Generation
System.out.println("Random double >>> " + RandomUtils.nextDouble());
System.out.println("Random float >>> " + RandomUtils.nextFloat());
System.out.println("Random int >>> " + RandomUtils.nextInt());
}
}