我需要创建一个名为rollDice的方法,它使用“随机”库生成并返回介于1到6之间的随机整数。
import random from 'random'
function rollDice(min:number, max:number) {
return Math.floor(Math.random() * (max - min + 1) + min)
}
let result = rollDice(1,6)
console.log(result)我不知道怎么叫‘随机’谢谢你的帮助!
发布于 2022-06-03 02:40:11
https://stackoverflow.com/questions/72484142
复制相似问题