Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. HashFunction HashFunction::getHashCoefs(const int k_value, const int prime_module) {
  2.     using std::uniform_int_distribution;
  3.     static uniform_int_distribution<int> distribution(0, prime_module - 1);
  4.     static uniform_int_distribution<int> distribution_for_previous_coef(1, prime_module - 1);
  5.     static std::default_random_engine generator;
  6.     vector<int64_t> coefs;
  7.     for (size_t i = 0; i < k_value - 1; ++i) {
  8.         coefs.push_back(distribution(generator));
  9.     }
  10.     coefs.push_back(distribution_for_previous_coef(generator));
  11.     return HashFunction(coefs, prime_module);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement