Java by API/org.apache.commons.math/RandomUtils
Версия от 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());
}
}