From 0e537b32ae8f80985d3fd6b898ad6151cd8ac86c Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Tue, 2 Aug 2022 18:45:00 +0800 Subject: feat: Implement expt_0729 Signed-off-by: KunoiSayami --- normal_distribution.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'normal_distribution.cpp') 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 #include -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 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 set; std::vector vector; -- cgit v1.3.1