wtto WTTO'S BLOG

JS 产生服从均匀分布随机数

Posted on: 2021年11月18日  at 03:09
JS 产生服从均匀分布随机数

[min, max]

Math.floor(Math.random() * (max - min + 1)) + min

[min, max)

Math.floor(Math.random() * (max - min)) + min

(min, max]

Math.ceil(Math.random() * (max - min)) + min

摘自:https://www.cnblogs.com/zztt/p/4024906.html

作者:  wtto
发表时间: 2021年11月18日
最后更新时间:  2024年2月5日
版权说明:  CC BY-NC-ND 4.0 DEED