aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/tests/ann/std-random.h
diff options
context:
space:
mode:
Diffstat (limited to 'eval/src/tests/ann/std-random.h')
-rw-r--r--eval/src/tests/ann/std-random.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/eval/src/tests/ann/std-random.h b/eval/src/tests/ann/std-random.h
new file mode 100644
index 00000000000..e48a56006fd
--- /dev/null
+++ b/eval/src/tests/ann/std-random.h
@@ -0,0 +1,21 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+#include <random>
+
+class RndGen {
+private:
+ std::mt19937_64 urng;
+ std::normal_distribution<double> normRng;
+ std::uniform_real_distribution<double> uf;
+public:
+ RndGen() : urng(0x1234deadbeef5678uLL), normRng(), uf(0.0, 1.0) {}
+
+ double nextNormal() {
+ return normRng(urng);
+ }
+
+ double nextUniform() {
+ return uf(urng);
+ }
+};