MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / random_pair

Function random_pair

tests/BS_thread_pool_test.cpp:572–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570 */
571template <typename T>
572std::pair<T, T> random_pair(const T min, const T max)
573{
574 static std::random_device rand_device;
575 static std::mt19937_64 twister(rand_device());
576 std::uniform_int_distribution<T> dist(min, max);
577 T first = dist(twister);
578 T second;
579 do
580 second = dist(twister);
581 while (second == first);
582 if (second < first)
583 return {second, first};
584 return {first, second};
585}
586
587// ========================================
588// Functions for detecting various features

Callers 3

check_loopFunction · 0.85
check_blocksFunction · 0.85
check_sequenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected