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;
この種のことは非常に些細なことです;)