MCPcopy Create free account
hub / github.com/facebook/CacheLib / getRandomNumbers

Function getRandomNumbers

cachelib/allocator/memory/tests/CompressedPtrTest.cpp:26–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24using Config = typename MemoryAllocator::Config;
25
26std::vector<int> getRandomNumbers(int N, int max) {
27 // Create a random number generator
28 std::random_device rd;
29 std::mt19937 gen(rd());
30 // Create a uniform distribution for the range [0, max]
31 std::uniform_int_distribution<int> dis(0, max);
32 // Generate N random numbers
33 std::vector<int> randomNumbers;
34 randomNumbers.reserve(N);
35 for (int i = 0; i < N; ++i) {
36 randomNumbers.push_back(dis(gen));
37 }
38 return randomNumbers;
39}
40
41TEST_F(CompressedPtrTest, Stats) {
42 auto compressedPtr = CompressedPtr4B();

Callers 1

TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected