Java中random的使用

random的作用范围[0.0,1.0),前闭后开
Math.random()       --->  [0.0,1.0)
Math.random()*3     ---> [0.0,3.0)
(int)(Math.random()*3) ---> [0,3)
posted @ 2021-07-06 00:07  蔡地像徐坤  阅读(275)  评论(0编辑  收藏  举报