hw10_04_infinite probability.html 312 B

1234567891011121314151617
  1. <head>array fill</head>
  2. <body>
  3. <script>
  4. let i = 0
  5. let a = 0.5;
  6. while ((a - 0.9) <= 0) {
  7. a = Math.random();
  8. i++;
  9. if ((a - 0.9) > 0) {
  10. break;
  11. //alert(i);
  12. }
  13. }
  14. alert(i);
  15. </script>
  16. </body>