I am writing a simulation for 2D random walk. I wrote several version of code, and found that the speed is like this (fastest to slowest): C++, Mathematica compiled procedural code, Mathematica functional code. However, the
rand() in C is not good enough for the experiment, and it is said that Mathematica uses cellular automation to generate random numbers, which have better distribution, so I wish to use the latter one.
There are two cases, the first one is just plain
Compile, the second one uses the option:
CompilationTarget -> "C", which is about 4 times faster than the first one. But the documentation states something scary (for the second case): the function is converted to C, compiled to DLL and linked back. I am wondering that if the compiled program uses the wolfram random algorithm or the rand() provided by C in those cases.
PS: I am using
RandomReal for random number generation.