diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2017-03-03 20:13:07 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2017-03-06 10:59:46 +0300 |
commit | 4109884b16954200224e50041694ae3c66533a8a (patch) | |
tree | 719ba8e6f70cc49e7bbc868f32dceb69bd1e7eba /base | |
parent | 8186a78cd634a863999cb30c438b98876d24881c (diff) |
Using RandomSample for CrossMwmGraphTest.
Diffstat (limited to 'base')
-rw-r--r-- | base/CMakeLists.txt | 2 | ||||
-rw-r--r-- | base/random.cpp | 4 | ||||
-rw-r--r-- | base/random.hpp | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index d4e2ad4bd4..22f1b391a1 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -35,6 +35,8 @@ set( newtype.hpp normalize_unicode.cpp observer_list.hpp + random.cpp + random.hpp range_iterator.hpp ref_counted.hpp rolling_hash.hpp diff --git a/base/random.cpp b/base/random.cpp index a6decf8498..964cffa314 100644 --- a/base/random.cpp +++ b/base/random.cpp @@ -3,7 +3,7 @@ #include <algorithm> #include <numeric> -namespace my +namespace base { std::vector<size_t> RandomSample(size_t n, size_t k, std::minstd_rand & rng) { @@ -19,4 +19,4 @@ std::vector<size_t> RandomSample(size_t n, size_t k, std::minstd_rand & rng) return result; } -} // my +} // base diff --git a/base/random.hpp b/base/random.hpp index b17189e36c..267ae22add 100644 --- a/base/random.hpp +++ b/base/random.hpp @@ -3,7 +3,8 @@ #include <random> #include <vector> -namespace my +namespace base { +// Selects a fair random subset of size min(|n|, |k|) from [0, 1, 2, ..., n - 1]. std::vector<size_t> RandomSample(size_t n, size_t k, std::minstd_rand & rng); -} // my +} // base |