11#include " default_types.h"
22#include < igl/random_points_on_mesh.h>
3+ #include < igl/generate_default_urbg.h>
34#include < nanobind/nanobind.h>
45#include < nanobind/eigen/dense.h>
56#include < nanobind/stl/tuple.h>
7+ #include < nanobind/stl/optional.h>
68
79namespace nb = nanobind;
810using namespace nb ::literals;
@@ -13,11 +15,13 @@ namespace pyigl
1315 auto random_points_on_mesh (
1416 const Integer n,
1517 const nb::DRef<const Eigen::MatrixXN> &V,
16- const nb::DRef<const Eigen::MatrixXI> &F)
18+ const nb::DRef<const Eigen::MatrixXI> &F,
19+ const std::optional<int > seed)
1720 {
21+ std::mt19937 urbg = seed.has_value () ? std::mt19937 (*seed) : igl::generate_default_urbg ();
1822 Eigen::VectorXI FI;
1923 Eigen::MatrixXN B,X;
20- igl::random_points_on_mesh (n, V, F, B, FI, X);
24+ igl::random_points_on_mesh (n, V, F, B, FI, X, urbg );
2125 return std::make_tuple (B, FI, X);
2226 }
2327}
@@ -32,6 +36,7 @@ void bind_random_points_on_mesh(nb::module_ &m)
3236 " n" _a,
3337 " V" _a,
3438 " F" _a,
39+ " seed" _a = nb::none (),
3540 R"(
3641 Randomly sample a mesh (V,F) n times.
3742
0 commit comments