但是,当我将1更改为高于或低于1的任何数字时,我得到相同的结果.为什么是这样? 1的意思究竟是什么意思?
Math.floor(Math.random() * N) + M
这将生成M和M N-1之间的值.
demo Fiddle