I wrote a Python program for Monte Carlo simulations that calls numpy functions that makes use of the built-in random number generator (e.g., np.random.normal() or np.random.choice()) and also imports some c++ functions (compiled using the standard numpy c-api) which also make use of a random number generator.

However, in order to be statistically correct, I need that both the numpy and numpy c-api functions use the same random number generator.

I presume I should pass the python random number generator to the c-api functions, or vice-versa.

How can I make sure that all the functions use the same pseudo random number generator?

0 Answers