wrap mt19937_64

release/4.3a0
Varun Agrawal 2025-05-15 18:11:29 -04:00
parent eb35ff8df6
commit 0d70a47571
1 changed files with 12 additions and 0 deletions

View File

@ -10,3 +10,15 @@
* with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python,
* and saves one copy operation.
*/
/*
* Custom Pybind11 module for the Mersenne-Twister PRNG object
* `std::mt19937_64`.
* This can be invoked with `gtsam.MT19937()` and passed
* wherever a rng pointer is expected.
*/
#include <random>
py::class_<std::mt19937_64>(m_, "MT19937")
.def(py::init<>())
.def(py::init<std::mt19937_64::result_type>())
.def("__call__", &std::mt19937_64::operator());