AlexanderSaydakov commented on code in PR #438: URL: https://github.com/apache/datasketches-cpp/pull/438#discussion_r1717813983
########## filters/include/bloom_filter_builder_impl.hpp: ########## @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef _BLOOM_FILTER_BUILDER_IMPL_HPP_ +#define _BLOOM_FILTER_BUILDER_IMPL_HPP_ + +#include <cmath> +#include <memory> +#include <vector> + +#include "common_defs.hpp" +#include "xxhash64.h" + +namespace datasketches { + +template<typename A> +uint64_t bloom_filter_builder_alloc<A>::generate_random_seed() { + union { + uint64_t long_value; + double double_value; + } ldu; + ldu.double_value = random_utils::next_double(random_utils::rand); Review Comment: this reinterpretation of double [0, 1] as uint64_t seems a bit too tricky. I am not sure it actually produces a number uniformly distributed in the 64-bit range. perhaps, std::uniform_int_distribution would be more straightforward? -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
