I developed monte carlo / stochastic software that uses MKL and Intel compiler. In general, you will have to wrap the random number generation in a C ++ dll. This is the easiest way, since you can control the management of names and calls. As for minimizing overhead, the best way to do this is to save the simulation code completely in C ++, where it probably still belongs, and only to call C # you need to get an update. The only way to minimize the penalty for interference is to make fewer calls, I found another piece of advice (/ unsafe, etc.) Useless in terms of performance. You can see an example of the interaction and structure of this type of program in my project repository - Stochfit .
Steve source share