PragmaTwice commented on code in PR #3562:
URL: https://github.com/apache/kvrocks/pull/3562#discussion_r3639590535


##########
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:
   Could you stop copy-pasting to me what your agent replies to you? You can do 
your own decision. I have enough token that I don't need an agent proxy.



-- 
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]

Reply via email to