MCPcopy Create free account
hub / github.com/alibaba/zvec / Shuffle

Function Shuffle

tests/core/algorithm/flat/flat_searcher_test.cpp:81–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81static void Shuffle(std::vector<uint32_t> &keys) {
82 if (keys.size() <= 1) {
83 return;
84 }
85 for (size_t i = keys.size() - 1; i > 0; i--) {
86 std::mt19937 gen((std::random_device())());
87 std::uniform_int_distribution<size_t> dist(0, i);
88 size_t pos = dist(gen);
89 std::swap(keys[i], keys[pos]);
90 }
91}
92
93TEST(FlatSearcher, NoBatch_FP32) {
94 std::mt19937 gen((std::random_device())());

Callers 1

TESTFunction · 0.85

Calls 2

swapFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected