jmetal随机数

jmetal随机数

觉得有用的话,欢迎一起讨论相互学习~

我的微博我的github我的B站

  • 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
//

posted @ 2020-04-23 22:23  WUST许志伟  阅读(208)  评论(0编辑  收藏  举报