add global PRNG to utilities.h

release/4.3a0
Varun Agrawal 2025-05-16 23:48:50 -04:00
parent d4c9c68b58
commit bc7646f82f
1 changed files with 12 additions and 5 deletions

View File

@ -1,11 +1,18 @@
#pragma once #pragma once
#include <string>
#include <iostream>
#include <sstream>
#include <gtsam/dllexport.h> #include <gtsam/dllexport.h>
#include <iostream>
#include <random>
#include <sstream>
#include <string>
/**
* @brief Global default pseudo-random number generator object.
* In wrappers we can access std::mt19937_64 via gtsam.MT19937
*/
static std::mt19937_64 kRandomNumberGenerator(42);
namespace gtsam { namespace gtsam {
/** /**
* For Python __str__(). * For Python __str__().
@ -28,7 +35,7 @@ private:
std::streambuf* coutBuffer_; std::streambuf* coutBuffer_;
}; };
} } // namespace gtsam
namespace gtsam { namespace gtsam {
// Adapted from https://stackoverflow.com/a/32223343/9151520 // Adapted from https://stackoverflow.com/a/32223343/9151520