File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
branches/try/src/libstd/rand Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5
- refs/heads/try: 348132196a1a25336d2df6b6e0989540cdc8f7e1
5
+ refs/heads/try: 86587224d0b99c69da01ebfaf98052694036302b
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
Original file line number Diff line number Diff line change 70
70
//! println!("{}", tuple)
71
71
//! ```
72
72
//!
73
- //! ## Monte Carlo estimation of pi
73
+ //! ## Monte Carlo estimation of π
74
74
//!
75
75
//! For this example, imagine we have a square with sides of length 2 and a unit
76
- //! circle, both centered at the origin. Since the area of a unit circle is pi ,
77
- //! the ratio
76
+ //! circle, both centered at the origin. Since the area of a unit circle is π ,
77
+ //! we have:
78
78
//!
79
79
//! ```notrust
80
- //! (area of unit circle) / (area of square)
80
+ //! (area of unit circle) / (area of square) = π / 4
81
81
//! ```
82
82
//!
83
- //! is equal to pi / 4. So if we sample many points randomly from the square,
84
- //! roughly pi / 4 of them should be inside the circle.
83
+ //! So if we sample many points randomly from the square, roughly π / 4 of them
84
+ //! should be inside the circle.
85
85
//!
86
- //! We can use the above fact to estimate the value of pi : pick many points in the
86
+ //! We can use the above fact to estimate the value of π : pick many points in the
87
87
//! square at random, calculate the fraction that fall within the circle, and
88
88
//! multiply this fraction by 4.
89
89
//!
You can’t perform that action at this time.
0 commit comments