Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <inttypes.h>
- #include <stdint.h>
- #include <random>
- double f1
- (
- double x1, double y1, double z1,
- double x2, double y2, double z2,
- double x3, double y3, double z3
- )
- {
- double a = fabsl((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2.0;
- a = a*a*a;
- return a;
- }
- int main()
- {
- std::random_device rd;
- std::mt19937 gen(rd());
- std::uniform_real_distribution<> dis(0, 1);
- double random_number = dis(gen);
- double acc = 0;
- #define END INTMAX_C(500000000)
- for (size_t i = 0; i < END; i++)
- {
- acc += f1(dis(gen),dis(gen),dis(gen),dis(gen),dis(gen),dis(gen),dis(gen),dis(gen),dis(gen));
- }
- printf("%f\n", (acc/1)/END);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement