“Java中的随机数”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) |
Jihongchang(讨论 | 贡献) |
||
第14行: | 第14行: | ||
</syntaxhighlight><syntaxhighlight lang="console"> | </syntaxhighlight><syntaxhighlight lang="console"> | ||
0.8981455972172399 | 0.8981455972172399 | ||
− | </syntaxhighlight> | + | </syntaxhighlight>[0.0,1.0) |
+ | |||
+ | 0.0 <= random < 1.0 |
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