Translate the RNG to C++
Created by: smharper
This PR replaces the F90 implementation of the LCG with a C++ implementation (it's really just C plus a few
extern "C" modifiers). Since the topic has come up in #936 and I already had this code written, I thought I would suggest it as an alternate solution.
@paulromano, if you think this PR is a good idea, then let me know and I'll do a smidgen more work on it before the merge. I haven't yet deliberately tested it against numbers that are >2^63. Note that the C code uses unsigned integers and Fortran doesn't have any concept of unsigned integers. I think that the implicit conversion from Fortran
integer(8)s to C
uint64_ts will work exactly the way we want it too, but I haven't yet verified. If it doesn't we can take advantage of the RNGs 2^63 period by adding little Fortran wrappers that ensure the C code is never called with negative numbers. And one more small thing, I think there is some redundancy we can remove in the lines
while (nskip > prn_mod) nskip += prn_mod; nskip &= prn_mask;