| Line |
Branch |
Exec |
Source |
| 1 |
|
|
#include "bindings.h" |
| 2 |
|
|
#include "common.h" |
| 3 |
|
|
|
| 4 |
|
|
#include "terraingen/random/philox.h" |
| 5 |
|
|
#include "terraingen/random/samplers.h" |
| 6 |
|
|
#include "terraingen/random/stream.h" |
| 7 |
|
|
#include "terraingen/random/value_distribution.h" |
| 8 |
|
|
|
| 9 |
|
|
#include <nanobind/ndarray.h> |
| 10 |
|
|
|
| 11 |
|
|
#include <cstdint> |
| 12 |
|
|
#include <limits> |
| 13 |
|
|
#include <optional> |
| 14 |
|
|
#include <vector> |
| 15 |
|
|
|
| 16 |
|
|
namespace terraingen::python { |
| 17 |
|
|
|
| 18 |
|
|
namespace { |
| 19 |
|
|
|
| 20 |
|
|
/// @brief `count` values of `draw()` as a NumPy array. |
| 21 |
|
|
template <typename T, typename Draw> |
| 22 |
|
12 |
nb::ndarray<nb::numpy, T> DrawArray(std::size_t count, Draw draw) { |
| 23 |
12/21
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 4 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 4 not taken.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 4 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 4 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 4 taken 1 time.
nanobind::ndarray<nanobind::numpy, unsigned int> terraingen::python::(anonymous namespace)::DrawArray<unsigned int, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 3 times.
nanobind::ndarray<nanobind::numpy, unsigned long> terraingen::python::(anonymous namespace)::DrawArray<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 5 times.
|
12 |
T* data = new T[count]; |
| 24 |
6/7
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 2 not taken.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, unsigned int> terraingen::python::(anonymous namespace)::DrawArray<unsigned int, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 2 taken 3 times.
nanobind::ndarray<nanobind::numpy, unsigned long> terraingen::python::(anonymous namespace)::DrawArray<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 5 times.
|
12 |
nb::capsule owner(data, [](void* p) noexcept { delete[] static_cast<T*>(p); }); |
| 25 |
12/14
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 20000 times.
✓ Branch 1 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 20000 times.
✓ Branch 1 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1 time.
nanobind::ndarray<nanobind::numpy, unsigned int> terraingen::python::(anonymous namespace)::DrawArray<unsigned int, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 3 times.
nanobind::ndarray<nanobind::numpy, unsigned long> terraingen::python::(anonymous namespace)::DrawArray<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 0 taken 160005 times.
✓ Branch 1 taken 5 times.
|
200048 |
for (std::size_t i = 0; i < count; ++i) { |
| 26 |
6/7
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 20000 times.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 1 not taken.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 3 times.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 20000 times.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 1 taken 10 times.
nanobind::ndarray<nanobind::numpy, unsigned int> terraingen::python::(anonymous namespace)::DrawArray<unsigned int, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 1 taken 18 times.
nanobind::ndarray<nanobind::numpy, unsigned long> terraingen::python::(anonymous namespace)::DrawArray<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 160005 times.
|
200036 |
data[i] = static_cast<T>(draw()); |
| 27 |
|
|
} |
| 28 |
|
12 |
const std::size_t shape[1] = {count}; |
| 29 |
6/7
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 2 not taken.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, double> terraingen::python::(anonymous namespace)::DrawArray<double, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#2}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
nanobind::ndarray<nanobind::numpy, unsigned int> terraingen::python::(anonymous namespace)::DrawArray<unsigned int, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindStream(nanobind::module_&)::{lambda(terraingen::RandomStream&, unsigned long)#1}::operator()(terraingen::RandomStream&, unsigned long) const::{lambda()#1}):
✓ Branch 2 taken 3 times.
nanobind::ndarray<nanobind::numpy, unsigned long> terraingen::python::(anonymous namespace)::DrawArray<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 5 times.
|
24 |
return nb::ndarray<nb::numpy, T>(data, 1, shape, owner); |
| 30 |
|
12 |
} |
| 31 |
|
|
|
| 32 |
|
|
/// @brief One value of `draw()`, or an array of `count` of them. |
| 33 |
|
|
template <typename T, typename Draw> |
| 34 |
|
15 |
nb::object Sample(std::optional<std::size_t> count, Draw draw) { |
| 35 |
9/10
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 5 times.
|
15 |
if (!count) { |
| 36 |
6/10
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 2 not taken.
✗ Branch 5 not taken.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 2 not taken.
✗ Branch 5 not taken.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
|
10 |
return nb::cast(draw()); |
| 37 |
|
|
} |
| 38 |
8/10
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, double, std::optional<unsigned long>) const::{lambda()#1}):
✗ Branch 3 not taken.
✗ Branch 6 not taken.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#2}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<double, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>)#1}::operator()(terraingen::TabulatedDistribution const&, terraingen::RandomStream&, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
nanobind::object terraingen::python::(anonymous namespace)::Sample<unsigned long, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}>(std::optional<unsigned long>, terraingen::python::(anonymous namespace)::BindSamplers(nanobind::module_&)::{lambda(terraingen::RandomStream&, double, std::optional<unsigned long>)#1}::operator()(terraingen::RandomStream&, double, std::optional<unsigned long>) const::{lambda()#1}):
✓ Branch 3 taken 5 times.
✓ Branch 6 taken 5 times.
|
8 |
return nb::cast(DrawArray<T>(*count, draw)); |
| 39 |
|
|
} |
| 40 |
|
|
|
| 41 |
|
44 |
void BindStream(nb::module_& m) { |
| 42 |
1/1
✓ Branch 1 taken 44 times.
|
44 |
m.def( |
| 43 |
|
|
"philox4x32", |
| 44 |
|
✗ |
[](std::uint32_t c0, std::uint32_t c1, std::uint32_t c2, std::uint32_t c3, std::uint32_t k0, |
| 45 |
|
|
std::uint32_t k1) { |
| 46 |
|
4 |
const U32x4 out = Philox4x32(U32x4{c0, c1, c2, c3}, U32x2{k0, k1}); |
| 47 |
1/1
✓ Branch 1 taken 4 times.
|
8 |
return nb::make_tuple(out.x, out.y, out.z, out.w); |
| 48 |
|
|
}, |
| 49 |
6/6
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
✓ Branch 10 taken 44 times.
✓ Branch 13 taken 44 times.
✓ Branch 16 taken 44 times.
|
88 |
"c0"_a, "c1"_a, "c2"_a, "c3"_a, "k0"_a, "k1"_a, |
| 50 |
|
|
"Philox4x32-10 (Salmon et al. 2011) of a 128-bit counter and 64-bit key, as four words."); |
| 51 |
|
✗ |
nb::class_<RandomStream>(m, "RandomStream", |
| 52 |
|
|
"Counter-based random stream on Philox4x32-10. The key is (seed, " |
| 53 |
|
|
"stream); a, b and c address an independent substream, such as a " |
| 54 |
|
|
"cell's x and y and a size band.") |
| 55 |
|
✗ |
.def(nb::init<std::uint32_t, std::uint32_t, std::uint32_t, std::uint32_t, std::uint32_t>(), |
| 56 |
5/5
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
✓ Branch 10 taken 44 times.
✓ Branch 13 taken 44 times.
|
220 |
"seed"_a, "stream"_a, "a"_a = 0u, "b"_a = 0u, "c"_a = 0u) |
| 57 |
|
44 |
.def("next_u32", &RandomStream::NextU32) |
| 58 |
|
44 |
.def("next_float", &RandomStream::NextFloat, "Uniform float32 in [0, 1).") |
| 59 |
|
44 |
.def("next_double", &RandomStream::NextDouble, "Uniform float64 in [0, 1).") |
| 60 |
|
44 |
.def("next_double_open_below", &RandomStream::NextDoubleOpenBelow, |
| 61 |
|
|
"Uniform float64 in (0, 1].") |
| 62 |
|
44 |
.def( |
| 63 |
|
|
"u32s", |
| 64 |
|
✗ |
[](RandomStream& s, std::size_t count) { |
| 65 |
|
21 |
return DrawArray<std::uint32_t>(count, [&] { return s.NextU32(); }); |
| 66 |
|
|
}, |
| 67 |
1/1
✓ Branch 1 taken 44 times.
|
44 |
"count"_a, "The next `count` 32-bit words as a NumPy array.") |
| 68 |
|
|
.def( |
| 69 |
|
|
"doubles", |
| 70 |
|
45 |
[](RandomStream& s, std::size_t count) { |
| 71 |
|
11 |
return DrawArray<double>(count, [&] { return s.NextDouble(); }); |
| 72 |
|
|
}, |
| 73 |
1/1
✓ Branch 1 taken 44 times.
|
88 |
"count"_a, "The next `count` uniform float64 values in [0, 1) as a NumPy array."); |
| 74 |
|
44 |
} |
| 75 |
|
|
|
| 76 |
|
44 |
void BindSamplers(nb::module_& m) { |
| 77 |
1/1
✓ Branch 1 taken 44 times.
|
44 |
m.def( |
| 78 |
|
|
"sample_poisson", |
| 79 |
|
✗ |
[](RandomStream& stream, double mean, std::optional<std::size_t> count) { |
| 80 |
|
160014 |
return Sample<std::uint64_t>(count, [&] { return SamplePoisson(stream, mean); }); |
| 81 |
|
|
}, |
| 82 |
3/3
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
|
132 |
"stream"_a, "mean"_a, "count"_a = nb::none(), |
| 83 |
|
|
"Poisson count (multiplication method below 10, Hormann's PTRS above); an array if " |
| 84 |
|
|
"`count` is given."); |
| 85 |
1/1
✓ Branch 1 taken 44 times.
|
44 |
m.def( |
| 86 |
|
|
"sample_truncated_power_law", |
| 87 |
|
✗ |
[](RandomStream& stream, double min, double max, double exponent, |
| 88 |
|
|
std::optional<std::size_t> count) { |
| 89 |
|
|
return Sample<double>( |
| 90 |
|
20003 |
count, [&] { return SampleTruncatedPowerLaw(stream, min, max, exponent); }); |
| 91 |
|
|
}, |
| 92 |
5/5
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
✓ Branch 10 taken 44 times.
✓ Branch 13 taken 44 times.
|
132 |
"stream"_a, "min"_a, "max"_a, "exponent"_a, "count"_a = nb::none(), |
| 93 |
|
|
"Power law on [min, max] with P(X > x) proportional to x**-exponent; max may be inf."); |
| 94 |
1/1
✓ Branch 1 taken 44 times.
|
44 |
m.def( |
| 95 |
|
|
"sample_exponential", |
| 96 |
|
✗ |
[](RandomStream& stream, double rate, std::optional<std::size_t> count) { |
| 97 |
|
6 |
return Sample<double>(count, [&] { return SampleExponential(stream, rate); }); |
| 98 |
|
|
}, |
| 99 |
3/3
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
|
132 |
"stream"_a, "rate"_a, "count"_a = nb::none(), "Exponential sample with the given rate."); |
| 100 |
1/1
✓ Branch 1 taken 44 times.
|
44 |
m.def( |
| 101 |
|
|
"sample_normal", |
| 102 |
|
✗ |
[](RandomStream& stream, double mean, double sigma, std::optional<std::size_t> count) { |
| 103 |
|
4 |
return Sample<double>(count, [&] { return SampleNormal(stream, mean, sigma); }); |
| 104 |
|
|
}, |
| 105 |
4/4
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
✓ Branch 10 taken 44 times.
|
132 |
"stream"_a, "mean"_a, "sigma"_a, "count"_a = nb::none(), |
| 106 |
|
|
"Normal sample via the Box-Muller transform."); |
| 107 |
|
✗ |
nb::class_<TabulatedDistribution>(m, "TabulatedDistribution", |
| 108 |
|
|
"Distribution given as a piecewise-linear CDF, sampled by " |
| 109 |
|
|
"inversion.") |
| 110 |
2/2
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
88 |
.def(nb::init<std::vector<double>, std::vector<double>>(), "values"_a, "cumulative"_a) |
| 111 |
1/1
✓ Branch 1 taken 44 times.
|
88 |
.def("cdf", &TabulatedDistribution::Cdf, "x"_a) |
| 112 |
|
|
.def( |
| 113 |
|
|
"sample", |
| 114 |
|
46 |
[](const TabulatedDistribution& table, RandomStream& stream, |
| 115 |
|
|
std::optional<std::size_t> count) { |
| 116 |
|
20003 |
return Sample<double>(count, [&] { return table.Sample(stream); }); |
| 117 |
|
|
}, |
| 118 |
2/2
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
132 |
"stream"_a, "count"_a = nb::none()); |
| 119 |
|
44 |
} |
| 120 |
|
|
|
| 121 |
|
44 |
void BindValueDistribution(nb::module_& m) { |
| 122 |
|
88 |
nb::enum_<ValueDistribution::Kind>(m, "ValueDistributionKind") |
| 123 |
|
44 |
.value("CONSTANT", ValueDistribution::Kind::Constant) |
| 124 |
|
44 |
.value("UNIFORM", ValueDistribution::Kind::Uniform) |
| 125 |
|
44 |
.value("NORMAL", ValueDistribution::Kind::Normal) |
| 126 |
|
|
.value("LOG_NORMAL", ValueDistribution::Kind::LogNormal); |
| 127 |
|
44 |
nb::class_<ValueDistribution>( |
| 128 |
|
|
m, "ValueDistribution", |
| 129 |
|
|
"A random value: constant `a`, uniform from `a` to `b`, normal or log-normal with mean " |
| 130 |
|
|
"`a` and deviation `b`, clipped to [min, max].") |
| 131 |
|
44 |
.def( |
| 132 |
|
|
"__init__", |
| 133 |
|
51 |
[](ValueDistribution* self, ValueDistribution::Kind kind, double a, double b, |
| 134 |
|
|
std::optional<double> min, std::optional<double> max) { |
| 135 |
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
✗ |
new (self) ValueDistribution{ |
| 136 |
1/1
✓ Branch 4 taken 7 times.
|
7 |
kind, a, b, min.value_or(-std::numeric_limits<double>::infinity()), Bound(max)}; |
| 137 |
|
7 |
}, |
| 138 |
3/3
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
|
176 |
"kind"_a = ValueDistribution::Kind::Constant, "a"_a = 0.0, "b"_a = 0.0, |
| 139 |
2/2
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
132 |
"min"_a = nb::none(), "max"_a = nb::none()) |
| 140 |
|
44 |
.def_rw("kind", &ValueDistribution::kind) |
| 141 |
|
44 |
.def_rw("a", &ValueDistribution::a) |
| 142 |
|
44 |
.def_rw("b", &ValueDistribution::b) |
| 143 |
|
44 |
.def_rw("min", &ValueDistribution::min) |
| 144 |
|
|
.def_rw("max", &ValueDistribution::max); |
| 145 |
2/2
✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 |
m.def("validate_value_distribution", &ValidateValueDistribution, "distribution"_a, |
| 146 |
|
|
kValidateDoc); |
| 147 |
|
44 |
} |
| 148 |
|
|
|
| 149 |
|
|
} // namespace |
| 150 |
|
|
|
| 151 |
|
44 |
void BindRandom(nb::module_& m) { |
| 152 |
|
44 |
BindStream(m); |
| 153 |
|
44 |
BindSamplers(m); |
| 154 |
|
44 |
BindValueDistribution(m); |
| 155 |
|
44 |
} |
| 156 |
|
|
|
| 157 |
|
|
} // namespace terraingen::python |
| 158 |
|
|
|