diff options
author | ilezhankin <ilezhankin@yandex-team.ru> | 2022-02-10 16:45:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:56 +0300 |
commit | 62a805381e41500fbc7914c37c71ab040a098f4e (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/random | |
parent | 1d125034f06575234f83f24f08677955133f140e (diff) | |
download | ydb-62a805381e41500fbc7914c37c71ab040a098f4e.tar.gz |
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/random')
-rw-r--r-- | util/random/entropy.cpp | 18 | ||||
-rw-r--r-- | util/random/entropy.h | 4 | ||||
-rw-r--r-- | util/random/random.cpp | 14 | ||||
-rw-r--r-- | util/random/random.h | 10 |
4 files changed, 23 insertions, 23 deletions
diff --git a/util/random/entropy.cpp b/util/random/entropy.cpp index 5b7da84f56..3617edb83d 100644 --- a/util/random/entropy.cpp +++ b/util/random/entropy.cpp @@ -177,25 +177,25 @@ namespace { }; struct TDefaultTraits { - THolder<TEntropyPoolStream> EP; + THolder<TEntropyPoolStream> EP; TSeedStream SS; inline TDefaultTraits() { - Reset(); + Reset(); } inline IInputStream& EntropyPool() noexcept { - return *EP; + return *EP; } inline IInputStream& Seed() noexcept { return SS; } - inline void Reset() noexcept { - EP.Reset(new TEntropyPoolStream(THostEntropy())); - } - + inline void Reset() noexcept { + EP.Reset(new TEntropyPoolStream(THostEntropy())); + } + static inline TDefaultTraits& Instance() { auto res = SingletonWithPriority<TDefaultTraits, 0>(); @@ -216,6 +216,6 @@ IInputStream& Seed() { return TRandomTraits::Instance().Seed(); } -void ResetEntropyPool() { - TRandomTraits::Instance().Reset(); +void ResetEntropyPool() { + TRandomTraits::Instance().Reset(); } diff --git a/util/random/entropy.h b/util/random/entropy.h index 553d0a6fb2..62029c1b63 100644 --- a/util/random/entropy.h +++ b/util/random/entropy.h @@ -16,6 +16,6 @@ IInputStream& EntropyPool(); IInputStream& Seed(); /* - * Re-initialize entropy pool - useful after forking in multi-process programs. + * Re-initialize entropy pool - useful after forking in multi-process programs. */ -void ResetEntropyPool(); +void ResetEntropyPool(); diff --git a/util/random/random.cpp b/util/random/random.cpp index 8c9f6bec77..71f9323856 100644 --- a/util/random/random.cpp +++ b/util/random/random.cpp @@ -86,8 +86,8 @@ DEF_RND(unsigned long) DEF_RND(unsigned short) DEF_RND(unsigned long long) -#undef DEF_RND - +#undef DEF_RND + template <> bool RandomNumber<bool>() { return RandomNumber<ui8>() % 2 == 0; @@ -113,11 +113,11 @@ template <> long double RandomNumber<long double>() { return RandomNumber<double>(); } - -void ResetRandomState() { - *GetRndGen<ui32>() = TRndGen<ui32>(); - *GetRndGen<ui64>() = TRndGen<ui64>(); -} + +void ResetRandomState() { + *GetRndGen<ui32>() = TRndGen<ui32>(); + *GetRndGen<ui64>() = TRndGen<ui64>(); +} void SetRandomSeed(int seed) { *GetRndGen<ui32>() = TRndGen<ui32>(seed); diff --git a/util/random/random.h b/util/random/random.h index 623639d92c..16b52d3995 100644 --- a/util/random/random.h +++ b/util/random/random.h @@ -18,11 +18,11 @@ T RandomNumber(); */ template <class T> T RandomNumber(T max); - -/* - * Re-initialize random state - useful after forking in multi-process programs. - */ -void ResetRandomState(); + +/* + * Re-initialize random state - useful after forking in multi-process programs. + */ +void ResetRandomState(); /* * Set random SEED |