ratchapong

Untitled

Feb 12th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. const arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
  2.  
  3. let win = 0;
  4. let trails = 10000000;
  5. for (let i = 0; i < trails; i++) {
  6. if (arr[Math.floor(Math.random() * arr.length)] === '0') {
  7. win += 50;
  8. }
  9. if (arr[Math.floor(Math.random() * arr.length)] === '0') {
  10. win += 30;
  11. }
  12. for (let k = 0; k < 8; k++) {
  13. if (arr[Math.floor(Math.random() * arr.length)] === '0') {
  14. win += 10;
  15. }
  16. }
  17. }
  18. console.log(win / trails);
Advertisement
Add Comment
Please, Sign In to add comment