samedi 3 décembre 2022

C++ Libraries in Python, initializing pseudo random generator seed each time in a loop

I have a pseudo random generator in a C++ library I made for Python and I want to call it N time, with an arbitrary N. Each time I'm simulating different things, so I want the pseudo random generator to start with the seed i asked each time, so that if some trouble goes on I can just simulate that specific thing, without waiting the whole loop to reach that point again.

I found out python initializes the seed 1 time for the whole loop, without resetting it. The pseudo random generator I'm using is https://github.com/Reputeless/Xoshiro-cpp and i can't find a way to reset the seed at the end of the code (with pseudo random generator of std library I could use the .seed() function, but it doesn't work here).

So I need a way to reset it at the end of the C code and asking python to reinitialize it each time, or a way to ask python not to do what I'm clearly not asking (better performance, but didn't know until I found out).

Thanks




Aucun commentaire:

Enregistrer un commentaire