I am rewriting (and parallelising) some Stata simulations in C++.
For testing purposes I would like to use Stata's random numbers.
So far my approach has been to generate the numbers in Stata, dump them to a CSV file (100s MB), and then read that in my C++ program. This is slow and inelegant.
Ideally I would like to generate the same uniforms with C++ code.
I have read that Stata uses the KISS algorithm (cite http://blog.stata.com/tag/random-numbers/). I found a C implementation at http://www0.cs.ucl.ac.uk/staff/d.jones/GoodPracticeRNG.pdf . But there are several variations of KISS, and there seems still a little work to make this take a single Stata style seed, and produce uniform numbers (the Stata blog suggests we take the binary expansion of the 32 bit int produced and return 0.binary_expansion).
Has anyone already written C/C++ code that will replicate numbers returned from Stata's uniform()?
Edit: the KISS seed computed using Stata's "set seed" seem to depend on an secret function. Cite = http://hsphsun3.harvard.edu/cgi-bin/lwgate/STATALIST/archives/statalist.1210/date/article-1132.html