Create 'num_threads' rngs, seeded using 'seed_rng'. Used when we want each thread to have its own RNG (since they are not thread-safe).
| 51 | /// Create 'num_threads' rngs, seeded using 'seed_rng'. Used when we want each thread |
| 52 | /// to have its own RNG (since they are not thread-safe). |
| 53 | static vector<std::mt19937> CreateThreadLocalRngs( |
| 54 | int num_threads, std::mt19937* seed_rng) { |
| 55 | vector<std::mt19937> rngs(num_threads); |
| 56 | for (std::mt19937& rng : rngs) rng.seed((*seed_rng)()); |
| 57 | return rngs; |
| 58 | } |
| 59 | |
| 60 | /// Create a random temporary directory with the given prefix returning the path to the |
| 61 | /// newly created directory. If 'rm_on_destruction' is true, the directory will be |