summaryrefslogtreecommitdiff
path: root/normal_distribution.cpp
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2022-08-02 18:45:00 +0800
committerKunoiSayami <[email protected]>2022-08-02 18:45:00 +0800
commit0e537b32ae8f80985d3fd6b898ad6151cd8ac86c (patch)
treeeebe523bc99743340d2fea52fb6d78897189e7b7 /normal_distribution.cpp
parentfa0d606d8958d72220e2a5407314c80c5557a5f4 (diff)
feat: Implement expt_0729
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'normal_distribution.cpp')
-rw-r--r--normal_distribution.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/normal_distribution.cpp b/normal_distribution.cpp
index 002beba..72f914c 100644
--- a/normal_distribution.cpp
+++ b/normal_distribution.cpp
@@ -5,15 +5,25 @@
#include <set>
#include <vector>
-constexpr size_t length = 1048576;
-
-int main() {
+int main(int argc, char const *argv[]) {
std::random_device randomDevice;
std::mt19937 randomEngine(randomDevice());
std::normal_distribution<long double> normalDistribution(2147483648,
2147483648);
+ size_t length;
+ if (argc == 1) {
+ length = 1048576;
+ } else {
+ try {
+ length = std::stol(argv[1]);
+ } catch (...) {
+ fprintf(stderr, "Wrong arguments\n");
+ return 1;
+ }
+ }
+
std::set<long long> set;
std::vector<long long> vector;