Python code example - Monte Carlo Simulation for calculating pi value, 3.1415...
1. Generate uniformly distributed random (x , y) points that lie inside the square: 0 ~ x ~ L, 0 ~ y ~ L.
2. Count the number of random points that lie inside the circle
3. Compute the ratio of the numbers inside the circle and the square for pi value
Ещё видео!