jmetal随机数
Posted cloud-ken
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jmetal随机数相关的知识,希望对你有一定的参考价值。
jmetal随机数
觉得有用的话,欢迎一起讨论相互学习~
util.PseudoRandom
import momfo.util.JMException;
import momfo.util.PseudoRandom;
import java.io.IOException;
public class TEST {
public static void main(String args[]) throws IOException, JMException, ClassNotFoundException {
double a;
int b;
System.out.println("a");
for (int i = 0; i < 10; i++) {
a = PseudoRandom.randDouble();//[0,1)之间Double随机数
System.out.print(a + " ");
}
System.out.println();
System.out.println("a1");
for (int i = 0; i < 10; i++) {
a = PseudoRandom.randDouble(4, 6);//[4,6)之间Double随机数
System.out.print(a + " ");
}
System.out.println();
System.out.println("b");
for (int i = 0; i < 10; i++) {
b = PseudoRandom.randInt();//[MIN,MAX]之间随机int
System.out.print(b + " ");
}
System.out.println();
System.out.println("b1");
for (int i = 0; i < 10; i++) {
b = PseudoRandom.randInt(4, 6);//[4,6]之间随机int
System.out.print(b + " ");
}
}
}
//
//a
////0.893533005774213 0.07816513260530611 0.4869539933600744 0.8177769687753218 0.27544874565660105 0.23549831987694247 0.4124868700840816 0.6208565778763979 0.7339800276483693 0.4197640482615421
////a1
////4.417186276890425.1443996859577194.3048072730057145.1948812304726664.12414821704159355.5027963572952664.66940242119941654.5100300734152435.4021398661208075.8221029619629245
////b
////-1451235094 -574686162 -953159134 -649590219 -2123255381 -751852844 -606911126 -308175231 -1028890223 -883161670
////b1
////5 5 6 4 4 4 6 5 5 6
////Process finished with exit code 0
//
以上是关于jmetal随机数的主要内容,如果未能解决你的问题,请参考以下文章