aboutsummaryrefslogtreecommitdiffstats
path: root/util/random
diff options
context:
space:
mode:
authorblaze <blaze@yandex-team.ru>2022-02-10 16:50:31 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:31 +0300
commit8de5e9fef85b2ab655e3bc1d77ee2674f417cd15 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/random
parent6813864abdb5ce336cde7a2e5cd80232ba54eef1 (diff)
downloadydb-8de5e9fef85b2ab655e3bc1d77ee2674f417cd15.tar.gz
Restoring authorship annotation for <blaze@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/random')
-rw-r--r--util/random/shuffle.h14
-rw-r--r--util/random/shuffle_ut.cpp18
2 files changed, 16 insertions, 16 deletions
diff --git a/util/random/shuffle.h b/util/random/shuffle.h
index 096440a4c3..274ac147c9 100644
--- a/util/random/shuffle.h
+++ b/util/random/shuffle.h
@@ -18,15 +18,15 @@ inline void Shuffle(TRandIter begin, TRandIterEnd end) {
Shuffle(begin, end, TFastRng64(Seed()));
}
}
-
-template <typename TRandIter, typename TRandIterEnd, typename TRandGen>
+
+template <typename TRandIter, typename TRandIterEnd, typename TRandGen>
inline void Shuffle(TRandIter begin, TRandIterEnd end, TRandGen&& gen) {
- const size_t sz = end - begin;
-
- for (size_t i = 1; i < sz; ++i) {
+ const size_t sz = end - begin;
+
+ for (size_t i = 1; i < sz; ++i) {
DoSwap(*(begin + i), *(begin + gen.Uniform(i + 1)));
- }
-}
+ }
+}
template <typename TRange>
inline void ShuffleRange(TRange& range) {
diff --git a/util/random/shuffle_ut.cpp b/util/random/shuffle_ut.cpp
index b8a7a18138..87cbae94c0 100644
--- a/util/random/shuffle_ut.cpp
+++ b/util/random/shuffle_ut.cpp
@@ -1,6 +1,6 @@
#include "fast.h"
#include "shuffle.h"
-#include "mersenne.h"
+#include "mersenne.h"
#include <library/cpp/testing/unittest/registar.h>
@@ -32,18 +32,18 @@ Y_UNIT_TEST_SUITE(TRandUtilsTest) {
Shuffle(b, e, args...);
};
- s1 = "0";
+ s1 = "0";
f();
- s1 = "01";
+ s1 = "01";
f();
- s1 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- s0 = s1.copy();
+ s1 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ s0 = s1.copy();
f();
- UNIT_ASSERT(s0 != s1); // if shuffle does work, chances it will fail are 1 to 64!.
- }
+ UNIT_ASSERT(s0 != s1); // if shuffle does work, chances it will fail are 1 to 64!.
+ }
Y_UNIT_TEST(TestShuffle) {
TestRange();
@@ -56,10 +56,10 @@ Y_UNIT_TEST_SUITE(TRandUtilsTest) {
}
Y_UNIT_TEST(TestShuffleMersenne32) {
- TMersenne<ui32> prng(24);
+ TMersenne<ui32> prng(24);
TestIter(prng);
- }
+ }
Y_UNIT_TEST(TestShuffleFast32) {
TFastRng32 prng(24, 0);