请教掷骰子这段程序
processing吧
全部回复
仅看楼主
level 2
Setada_唯 楼主
void setup(){
println("Ready to roll");
rollDice(20);
rollDice(20);
rollDice(6);
println("Finished");
}
void rollDice(int numSides){
int d=1+int(random(numSides));
println("Rolling..."+d);
}
这段程序写在教程上,我没读懂最终的输出结果是怎么来的,?那个随机数的范围是怎么来的?
2018年11月15日 06点11分 1
level 6
https://processing.org/reference/random_.html
如果是random(一个参数)的话,范围就是0~参数
2018年11月15日 08点11分 2
random(a):0<=x<a
2018年11月15日 08点11分
谢谢[哈哈]
2018年11月16日 05点11分
请问randomSeed()是什么作用?保证每次的随机值不同吗?
2018年12月06日 03点12分
1