aboutsummaryrefslogtreecommitdiffstats
path: root/util/random
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:44 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:44 +0300
commit59e19371de37995fcb36beb16cd6ec030af960bc (patch)
treefa68e36093ebff8b805462e9e6d331fe9d348214 /util/random
parent89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff)
downloadydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/random')
-rw-r--r--util/random/entropy.h2
-rw-r--r--util/random/mersenne.h2
-rw-r--r--util/random/mersenne32.h2
-rw-r--r--util/random/mersenne64.h2
-rw-r--r--util/random/random.h8
-rw-r--r--util/random/shuffle.h12
-rw-r--r--util/random/shuffle_ut.cpp20
7 files changed, 24 insertions, 24 deletions
diff --git a/util/random/entropy.h b/util/random/entropy.h
index 62029c1b63..85dee81fa2 100644
--- a/util/random/entropy.h
+++ b/util/random/entropy.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
class TBuffer;
class IInputStream;
diff --git a/util/random/mersenne.h b/util/random/mersenne.h
index b2044604ac..ab55a6d063 100644
--- a/util/random/mersenne.h
+++ b/util/random/mersenne.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "mersenne64.h"
#include "mersenne32.h"
diff --git a/util/random/mersenne32.h b/util/random/mersenne32.h
index 861f3a3d38..c4c9e3d2e9 100644
--- a/util/random/mersenne32.h
+++ b/util/random/mersenne32.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/system/defaults.h>
diff --git a/util/random/mersenne64.h b/util/random/mersenne64.h
index 12ca43b6af..1639cfc88c 100644
--- a/util/random/mersenne64.h
+++ b/util/random/mersenne64.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include <util/system/defaults.h>
diff --git a/util/random/random.h b/util/random/random.h
index 16b52d3995..be1c26e272 100644
--- a/util/random/random.h
+++ b/util/random/random.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
/*
* thread-safe random number generator.
@@ -13,9 +13,9 @@
template <class T>
T RandomNumber();
-/*
- * returns value in range [0, max)
- */
+/*
+ * returns value in range [0, max)
+ */
template <class T>
T RandomNumber(T max);
diff --git a/util/random/shuffle.h b/util/random/shuffle.h
index 274ac147c9..339864217c 100644
--- a/util/random/shuffle.h
+++ b/util/random/shuffle.h
@@ -1,14 +1,14 @@
-#pragma once
-
+#pragma once
+
#include "fast.h"
#include "entropy.h"
-#include <util/generic/utility.h>
+#include <util/generic/utility.h>
// some kind of https://en.wikipedia.org/wiki/Fisher–Yates_shuffle#The_modern_algorithm
template <typename TRandIter, typename TRandIterEnd>
-inline void Shuffle(TRandIter begin, TRandIterEnd end) {
+inline void Shuffle(TRandIter begin, TRandIterEnd end) {
static_assert(sizeof(end - begin) <= sizeof(size_t), "fixme");
static_assert(sizeof(TReallyFastRng32::RandMax()) <= sizeof(size_t), "fixme");
@@ -16,8 +16,8 @@ inline void Shuffle(TRandIter begin, TRandIterEnd end) {
Shuffle(begin, end, TReallyFastRng32(Seed()));
} else {
Shuffle(begin, end, TFastRng64(Seed()));
- }
-}
+ }
+}
template <typename TRandIter, typename TRandIterEnd, typename TRandGen>
inline void Shuffle(TRandIter begin, TRandIterEnd end, TRandGen&& gen) {
diff --git a/util/random/shuffle_ut.cpp b/util/random/shuffle_ut.cpp
index 87cbae94c0..4d2415557e 100644
--- a/util/random/shuffle_ut.cpp
+++ b/util/random/shuffle_ut.cpp
@@ -3,23 +3,23 @@
#include "mersenne.h"
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/generic/ylimits.h>
-
+
+#include <util/generic/ylimits.h>
+
Y_UNIT_TEST_SUITE(TRandUtilsTest) {
template <typename... A>
static void TestRange(A&&... args) {
TString s0, s1;
ShuffleRange(s1, args...);
- s1 = "0";
+ s1 = "0";
ShuffleRange(s1, args...);
- s1 = "01";
+ s1 = "01";
ShuffleRange(s1, args...);
- s1 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- s0 = s1.copy();
+ s1 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ s0 = s1.copy();
ShuffleRange(s1, args...);
- 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!.
+ }
template <typename... A>
static void TestIter(A&&... args) {
@@ -72,4 +72,4 @@ Y_UNIT_TEST_SUITE(TRandUtilsTest) {
TestIter(prng);
}
-}
+}