Well, did you try creating a script function that calls a C++ function to generate those numbers?

You can create wrapper functions for your scripts. Keep performance demanding functions in C++ and provide wrapper or access functions in your scripts.