js如何生成指定范围内的随机数

 let min = 10;
 let max = 30;
 let res = Math.floor(min + Math.random()*(max - min))
 console.log(res);

 

posted @ 2023-02-13 16:42  黑白棋学弟  阅读(19)  评论(0编辑  收藏  举报