Debian Codegraph @

tests/integration/test_glibcxx_3_4_25/testentropy.cpp

raw
1 #include <Python.h>
2 #include <random>
3
4 static PyObject *
5 run(PyObject *self, PyObject *args)
6 {
7 (void)self;
8 (void)args;
9 std::random_device rd;
10 return PyLong_FromLong(rd.entropy() >= 0.0 ? 0 : -1);
11 }
12
13 /* Module initialization */
14 PyMODINIT_FUNC PyInit_testentropy(void)
15 {
16 static PyMethodDef module_methods[] = {
17 {"run", (PyCFunction)run, METH_NOARGS, "run."},
18 {NULL} /* Sentinel */
19 };
20 static struct PyModuleDef moduledef = {
21 PyModuleDef_HEAD_INIT,
22 "testentropy",
23 "testentropy module",
24 -1,
25 module_methods,
26 };
27 return PyModule_Create(&moduledef);
28 }