13
edits
Changes
→Code
ts = steady_clock::now();
for (i = 0; i<dart; ++i) {
x = (double)generateNumber();
y = (double)generateNumber();
++score;
}
pi = ((double)score / (double)dart)*4.0; // p = 4(m/n)
std::cout << "After " << i << " throws, average pi is " << pi << std::endl;
te = steady_clock::now();