File tree 2 files changed +2
-18
lines changed
2 files changed +2
-18
lines changed Original file line number Diff line number Diff line change 1
1
#include " log.h"
2
2
#include < util/generic/serialized_enum.h>
3
+ #include < util/random/normal.h>
3
4
#include < util/random/random.h>
4
5
#include < util/datetime/base.h>
5
6
6
- #include < cmath>
7
- #include < iomanip>
8
- #include < string>
9
- #include < thread>
10
- #include < random>
11
- #include < sstream>
12
- #include < chrono>
13
- #include < format>
14
-
15
7
namespace NYdbWorkload {
16
8
17
9
namespace NLog {
@@ -22,8 +14,6 @@ using TRow = TLogGenerator::TRow;
22
14
TLogGenerator::TLogGenerator (const TLogWorkloadParams* params)
23
15
: TBase(params)
24
16
, TotalColumnsCnt(1 + Params.IntColumnsCnt + Params.StrColumnsCnt)
25
- , RandomDevice()
26
- , Mt19937(RandomDevice())
27
17
{
28
18
Y_ABORT_UNLESS (TotalColumnsCnt >= Params.KeyColumnsCnt );
29
19
}
@@ -209,10 +199,9 @@ TVector<std::string> TLogGenerator::GetCleanPaths() const {
209
199
TVector<TRow> TLogGenerator::GenerateRandomRows () {
210
200
TVector<TRow> result (Params.RowsCnt );
211
201
212
- std::normal_distribution<double > normal_distribution_generator (0 , static_cast <double >(Params.TimestampStandardDeviationMinutes ));
213
202
for (size_t row = 0 ; row < Params.RowsCnt ; ++row) {
214
203
result[row].Ts = TInstant::Now ();
215
- i64 millisecondsDiff = 60 * 1000 * normal_distribution_generator (Mt19937 );
204
+ i64 millisecondsDiff = 60 * 1000 * NormalRandom ( 0 ., static_cast < double >(Params. TimestampStandardDeviationMinutes ) );
216
205
if (millisecondsDiff >= 0 ) { // TDuration::MilliSeconds can't be negative for some reason...
217
206
result[row].Ts = result[row].Ts + TDuration::MilliSeconds (millisecondsDiff);
218
207
} else {
Original file line number Diff line number Diff line change 3
3
#include < ydb/library/workload/abstract/workload_query_generator.h>
4
4
5
5
#include < cctype>
6
- #include < random>
7
- #include < sstream>
8
6
9
7
namespace NYdbWorkload {
10
8
@@ -102,9 +100,6 @@ class TLogGenerator final: public TWorkloadQueryGeneratorBase<TLogWorkloadParams
102
100
TVector<TRow> GenerateRandomRows ();
103
101
104
102
const ui64 TotalColumnsCnt;
105
-
106
- std::random_device RandomDevice;
107
- std::mt19937 Mt19937;
108
103
};
109
104
110
105
} // namespace NLog
You can’t perform that action at this time.
0 commit comments