49 py::class_<Random> clsRandom(mod,
"Random");
52 py::enum_<Random::Algorithm>(clsRandom,
"Algorithm")
53 .value(
"MT19937", Random::Algorithm::MT19937)
54 .value(
"RANLXS0", Random::Algorithm::RANLXS0)
55 .value(
"RANLXS1", Random::Algorithm::RANLXS1)
56 .value(
"RANLXS2", Random::Algorithm::RANLXS2)
57 .value(
"RANLXD1", Random::Algorithm::RANLXD1)
58 .value(
"RANLXD2", Random::Algorithm::RANLXD2)
59 .value(
"RANLUX", Random::Algorithm::RANLUX)
60 .value(
"RANLUX389", Random::Algorithm::RANLUX389)
61 .value(
"CMRG", Random::Algorithm::CMRG)
62 .value(
"MRG", Random::Algorithm::MRG)
63 .value(
"TAUS", Random::Algorithm::TAUS)
64 .value(
"TAUS2", Random::Algorithm::TAUS2)
65 .value(
"GFSR4", Random::Algorithm::GFSR4)
66 .value(
"NUM_ALGORITHMS", Random::Algorithm::NUM_ALGORITHMS)
70 clsRandom.def(py::init<Random::Algorithm, unsigned long>(),
"algorithm"_a = Random::Algorithm::MT19937,
72 clsRandom.def(py::init<std::string const &, unsigned long>(),
"algorithm"_a,
"seed"_a = 1);
75 clsRandom.def(
"deepCopy", &Random::deepCopy);
76 clsRandom.def(
"getAlgorithm", &Random::getAlgorithm);
77 clsRandom.def(
"getAlgorithmName", &Random::getAlgorithmName);
78 clsRandom.def_static(
"getAlgorithmNames", &Random::getAlgorithmNames);
79 clsRandom.def(
"getSeed", &Random::getSeed);
80 clsRandom.def(
"uniform", &Random::uniform);
81 clsRandom.def(
"uniformPos", &Random::uniformPos);
82 clsRandom.def(
"uniformInt", &Random::uniformInt);
83 clsRandom.def(
"flat", &Random::flat);
84 clsRandom.def(
"gaussian", &Random::gaussian);
85 clsRandom.def(
"chisq", &Random::chisq);
86 clsRandom.def(
"poisson", &Random::poisson);
91 clsRandom.def(
"getState", [](
Random &
self) -> py::object {
93 return py::reinterpret_steal<py::object>(PyBytes_FromStringAndSize(state.
data(), state.
size()));
95 clsRandom.def(
"setState", [](
Random &
self,
py::bytes const &state) {
self.setState(state); });
98 declareRandomImage<lsst::afw::image::Image<double>>(mod);
99 declareRandomImage<lsst::afw::image::Image<float>>(mod);
A class that can be used to generate sequences of random numbers according to a number of different a...