#define SIMGRID_XBT_RANDOM_HPP
#include "xbt/base.h"
+#include <fstream>
+#include <iostream>
#include <random>
+#include <string>
namespace simgrid {
namespace xbt {
*/
void set_seed(int seed) { mt19937_gen.seed(seed); }
+ /**
+ * @brief Read the state of the Mersenne-Twister RNG from a file
+ */
+ void read_state(std::string filename)
+ {
+ std::ifstream file(filename);
+ file >> mt19937_gen;
+ }
+
+ /**
+ * @brief Write the state of the Mersenne-Twister RNG to a file
+ */
+ void write_state(std::string filename)
+ {
+ std::ofstream file(filename);
+ file << mt19937_gen;
+ }
+
/**
* @brief Draws an integer number uniformly in range [min, max] (min and max included)
*
*/
void set_mersenne_seed(int);
+/**
+ * @brief Read the state of the Mersenne-Twister RNG from a file
+ */
+void read_mersenne_state(std::string filename);
+
+/**
+ * @brief Write the state of the Mersenne-Twister RNG to a file
+ */
+void write_mersenne_state(std::string filename);
+
/**
* @brief Draws an integer number uniformly in range [min, max] (min and max included)
*