I want to generate random values in a parallel context with cython. I have some cpp code and I don't know how to convert it in cython (or import it from a cpp file)
My cpp code is :
#include <random>
static std::random_device rand_device;
static std::mt19937 rnd_gen(rand_device());
static std::uniform_real_distribution<> rnd_unif(0, 1);
What I suppose is to define a cpp file with these lines of code but what can I write in the cython file to import it and use it?
I saw the canonical-way-to-generate-random-numbers-in-cython coming from a similar question, but that generates alway the same number
Coming from there I need to do a setup like this:
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(
name="cyvmc",
version="1.0",
packages=["cyvmc"],
ext_modules=cythonize(["cyvmc/*.pyx"]),
include_dirs=[numpy.get_include()],
)
This setup will find the cpp file: am I correct ?
After that I don't know how to import cpp file for the cython usage I'm not familiar with c++. Do I need to create a rand.h if I only use this 4 lines of code