diff options
Diffstat (limited to 'normal_distribution.cpp')
| -rw-r--r-- | normal_distribution.cpp | 16 |
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; |
