Skip to content

Commit 2d26edc

Browse files
Wesley-Arringtonleios
authored andcommitted
Small change to C Implementation of Monte Carlo (#260)
- Removed radius parameter from monte_carlo function
1 parent 60b2ab5 commit 2d26edc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

chapters/algorithms/monte_carlo_integration/code/c/monte_carlo.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ bool in_circle(double x, double y, double radius) {
88
return x * x + y * y < radius * radius;
99
}
1010

11-
void monte_carlo(int samples, double radius) {
11+
void monte_carlo(int samples) {
12+
double radius = 1.0;
1213
int count = 0;
1314

1415
for (int i = 0; i < samples; ++i) {
@@ -29,7 +30,7 @@ void monte_carlo(int samples, double radius) {
2930
int main() {
3031
srand(time(NULL));
3132

32-
monte_carlo(1000000, 1.0);
33+
monte_carlo(1000000);
3334

3435
return 0;
3536
}

0 commit comments

Comments
 (0)