]> AND Public Git Repository - simgrid.git/blobdiff - include/xbt/random.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
differenciated signal on_route_creation depending if its for a route inside a zone...
[simgrid.git] / include / xbt / random.hpp
index 26492e2ad6cd8984e66b6fea324afb0557a8297e..7d4e4ef30b14a746a12c0fb4157b9e2c4b831458 100644 (file)
@@ -7,7 +7,10 @@
 #define SIMGRID_XBT_RANDOM_HPP
 
 #include "xbt/base.h"
+#include <fstream>
+#include <iostream>
 #include <random>
+#include <string>
 
 namespace simgrid {
 namespace xbt {
@@ -34,6 +37,16 @@ public:
    */
   void set_seed(int seed) { mt19937_gen.seed(seed); }
 
+  /**
+   * @brief Read the state of the Mersenne-Twister RNG from a file
+   */
+  bool read_state(const std::string& filename);
+
+  /**
+   * @brief Write the state of the Mersenne-Twister RNG to a file
+   */
+  bool write_state(const std::string& filename) const;
+
   /**
    * @brief Draws an integer number uniformly in range [min, max] (min and max included)
    *
@@ -111,6 +124,16 @@ void set_implem_std();
  */
 void set_mersenne_seed(int);
 
+/**
+ * @brief Read the state of the Mersenne-Twister RNG from a file.
+ */
+bool read_mersenne_state(const std::string& filename);
+
+/**
+ * @brief Write the state of the Mersenne-Twister RNG to a file.
+ */
+bool write_mersenne_state(const std::string& filename);
+
 /**
  * @brief Draws an integer number uniformly in range [min, max] (min and max included)
  *