| 30 | } |
| 31 | |
| 32 | void compare_1d(unsigned n, int distrib) { |
| 33 | auto r = random_array(n, distrib); |
| 34 | |
| 35 | double best_root = std::numeric_limits<double>::max(); |
| 36 | for (unsigned k = 0; k < 20; ++k) { |
| 37 | TH1I hroot("", "", 100, 0, 1); |
| 38 | auto t = clock(); |
| 39 | for (unsigned i = 0; i < n; ++i) hroot.Fill(r[i]); |
| 40 | t = clock() - t; |
| 41 | best_root = std::min(best_root, double(t) / CLOCKS_PER_SEC); |
| 42 | } |
| 43 | printf("root %.3f\n", best_root); |
| 44 | } |
| 45 | |
| 46 | void compare_2d(unsigned n, int distrib) { |
| 47 | auto r = random_array(n, distrib); |