advisedy commented on code in PR #3562:
URL: https://github.com/apache/kvrocks/pull/3562#discussion_r3639737675
##########
src/search/hnsw_indexer.cc:
##########
@@ -173,14 +172,15 @@ StatusOr<double> ComputeSimilarity(const VectorItem&
left, const VectorItem& rig
}
HnswIndex::HnswIndex(const SearchKey& search_key, HnswVectorFieldMetadata*
vector, engine::Storage* storage,
- std::random_device::result_type seed)
+ std::optional<std::random_device::result_type> seed)
: search_key(search_key),
metadata(vector),
storage(storage),
- generator(std::mt19937(seed)),
+ seed(seed),
m_level_normalization_factor(1.0 / std::log(metadata->m)) {}
uint16_t HnswIndex::RandomizeLayer() {
+ static thread_local std::mt19937 generator = [this] { return
std::mt19937(seed.value_or(std::random_device()())); }();
Review Comment:
I’m very sorry that I relied too much on AI when replying, but my genuine
intention was to contribute. I’m truly sorry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]