jmetal随机数

时间:2022-07-23
本文章向大家介绍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
//