Java中的随机数

来自姬鸿昌的知识库
Jihongchang讨论 | 贡献2022年12月10日 (六) 05:48的版本
跳到导航 跳到搜索

Math.random()

public class Test {

    public static void main(String[] args) {

        double random = Math.random();

        System.out.println(random);

    }

}
0.8981455972172399

[0.0,1.0)

0.0 <= random < 1.0