| 44 | } |
| 45 | |
| 46 | void compare_2d(unsigned n, int distrib) { |
| 47 | auto r = random_array(n, distrib); |
| 48 | |
| 49 | double best_root = std::numeric_limits<double>::max(); |
| 50 | for (unsigned k = 0; k < 20; ++k) { |
| 51 | TH2I hroot("", "", 100, 0, 1, 100, 0, 1); |
| 52 | auto t = clock(); |
| 53 | for (unsigned i = 0; i < n / 2; ++i) hroot.Fill(r[2 * i], r[2 * i + 1]); |
| 54 | t = clock() - t; |
| 55 | best_root = std::min(best_root, double(t) / CLOCKS_PER_SEC); |
| 56 | } |
| 57 | printf("root %.3f\n", best_root); |
| 58 | } |
| 59 | |
| 60 | void compare_3d(unsigned n, int distrib) { |
| 61 | auto r = random_array(n, distrib); |