diff options
author | ilezhankin <ilezhankin@yandex-team.ru> | 2022-02-10 16:45:55 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:55 +0300 |
commit | 1d125034f06575234f83f24f08677955133f140e (patch) | |
tree | ec05fbbd61dc118d5de37f206ab978cff58774bd /util/random | |
parent | 3a7a498715ef1b66f5054455421b845e45e3a653 (diff) | |
download | ydb-1d125034f06575234f83f24f08677955133f140e.tar.gz |
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 1 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 3617edb83d..5b7da84f56 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 62029c1b63..553d0a6fb2 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 71f9323856..8c9f6bec77 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 16b52d3995..623639d92c 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 |