Generates a point randomly drawn from the unit square [0, 1) x [0, 1).
(cls)
| 15 | |
| 16 | @classmethod |
| 17 | def random_unit_square(cls): |
| 18 | """ |
| 19 | Generates a point randomly drawn from the unit square [0, 1) x [0, 1). |
| 20 | """ |
| 21 | return cls(x=random.random(), y=random.random()) |
| 22 | |
| 23 | |
| 24 | def estimate_pi(number_of_simulations: int) -> float: |