Closed dougmet closed 9 years ago
Bit of a thorny issue with regard to behaving the same way in R and Python. Might be able to wrap it up.
The seed needs to be able to be set from the R side. So we'll either use an R RNG (not my preference) or we'll somehow make the RNG state persist between function calls.
I would say it's a requirement that a user can set the seed in R and that passes through to the C++ code. This being said I'm not wildly happy about using the R RNGs. Option 1: Use the R based RNGs and stop worrying. Option 2: Pull through the RNG state vector and push it back when done. Option 3: Look at how gsl is used with set.seed. Option 4: Look at RcppArmadillo.
Of course you must remember that in dense_hybrid I'd like this to be easily swap-outable. Probably an ifdef around the mt() function.
Fixes #12. It's looking a bit buggy though. 960c241ed025
I'm having too many problems with the Rcpp random numbers. Let's bring back MersenneTwister.h. Remember to add it to the license. What we can do for now is use Rcpp random numbers to fill up the random state. This will give reproducible random numbers and if we use a big enough seed then it won't have problems with repetition.
rng_wrap was removed in 549192b
Swapped back to MersenneTwister.h because Rcpp random numbers were crashing all the time. Instead I'm linking with the R seed by using R to fill the MT. Fixes #12 and might affect #22. b967521e9b6b
New GitHub comment. I bugs me that it crashed so much trying to use the Rcpp solution. I'd like a permanent good solution using RNGs in C++ from R.
(migrated from bitbucket.org/dougashton/unsumnet)