Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我们可以说,例如,1/20 倍你将获得 200 个硬币。如果失败,您将获得 3 个硬币。或 1/2 次您将获得 9 个硬币,依此类推。
有人可以教我吗?
PHP:
if(rand(1,20) == 1) $prize = 200; else $prize = 3;
JS:
if(Math.random() < 1/20) prize = 200; else prize = 3;
这种事情很琐碎;)