From d4378c41dbf5a0cc662792fb0ac50a35aa78b4ba Mon Sep 17 00:00:00 2001 From: Moritz Sallermann Date: Sun, 28 Jul 2024 14:33:09 +0000 Subject: [PATCH] config: change type of rng_seed to int64_t The old type (a plain int with 32 bits) could overflow easily, which might cause confusion. Co-authored-by: Amrita Goswami --- include/config_parser.hpp | 3 ++- src/config_parser.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/config_parser.hpp b/include/config_parser.hpp index 86f63bb..48f14e5 100644 --- a/include/config_parser.hpp +++ b/include/config_parser.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -102,7 +103,7 @@ struct SimulationOptions = std::variant; Model model; std::string model_string; - int rng_seed = std::random_device()(); + int64_t rng_seed = std::random_device()(); OutputSettings output_settings; ModelVariantT model_settings; InitialNetworkSettings network_settings; diff --git a/src/config_parser.cpp b/src/config_parser.cpp index 57e384f..a674cc5 100644 --- a/src/config_parser.cpp +++ b/src/config_parser.cpp @@ -113,7 +113,7 @@ SimulationOptions parse_config_file( std::string_view config_file_path ) toml::table tbl; tbl = toml::parse_file( config_file_path ); - options.rng_seed = tbl["simulation"]["rng_seed"].value_or( int( options.rng_seed ) ); + options.rng_seed = tbl["simulation"]["rng_seed"].value_or( int64_t( options.rng_seed ) ); // Parse output settings options.output_settings.n_output_network = tbl["io"]["n_output_network"].value();