PROGRAMMING:JMU Java - random number - use Monte Carlo method to calculate the value of PI
Try to use Monte Carlo method to calculate the value of PI. The principle is as follows:
Draw a circle with the origin (0, 0) as the center and radius 1. The circumscribed square of the circle has a side length of 2.
Now randomly cast points into the square. If there are enough points, the points falling into the circle are the same as the points falling into the whole square
The ratio of the number of points of the circumscribed square is approximately: $$dfrac {pi * R ^ 2} {4 * R ^ 2} $$, and then you can get the value of $$$PI $$.
**Attention**
1. Please use random object in JDK library to generate random number.
2. Use sqrt and POW functions in math class to calculate the open root and square value.
3. Let the point (x, y) cast in the whole rectangle, and the value range of X and Y is (- 1 ≤ x < 1, - 1 ≤ y < 1).
###Input format:
Random number seed number n
Note: seed is of long type and N is of int type
###Output format:
The calculated value is the value of PI
###Input example:
```in
2 100000
```
###Output example:
```out
three point one four six eight four
```
answer:If there is no answer, please comment
Draw a circle with the origin (0, 0) as the center and radius 1. The circumscribed square of the circle has a side length of 2.
Now randomly cast points into the square. If there are enough points, the points falling into the circle are the same as the points falling into the whole square
The ratio of the number of points of the circumscribed square is approximately: $$dfrac {pi * R ^ 2} {4 * R ^ 2} $$, and then you can get the value of $$$PI $$.
**Attention**
1. Please use random object in JDK library to generate random number.
2. Use sqrt and POW functions in math class to calculate the open root and square value.
3. Let the point (x, y) cast in the whole rectangle, and the value range of X and Y is (- 1 ≤ x < 1, - 1 ≤ y < 1).
###Input format:
Random number seed number n
Note: seed is of long type and N is of int type
###Output format:
The calculated value is the value of PI
###Input example:
```in
2 100000
```
###Output example:
```out
three point one four six eight four
```
answer:If there is no answer, please comment