Open s3alfisc opened 1 year ago
Anyway I could help with this change?
BTW, I know you have been waiting a long time for weighted sampling in dqrng
. For the time being, you could just throw an unfair coin:
mammen = function(n) {
ifelse(
dqrng::dqrunif(n) < (sqrt(5) + 1) / (2 * sqrt(5)),
(1 - sqrt(5)) / 2,
(1 + sqrt(5)) / 2
)
},
This is slower than you current implementation with sample()
, but it would be controlled by the same state / seed as the other "dqrng" weights.
Hi @rstub - this is already implemented =) I am only waiting for me to address a few changes for an ropensci review yet.
Changing the Mammen weights as in your suggestions sounds like a great plan. I'd be happy to accept a PR but can also just implement it myself =) I definitely agree that seed state uniformity definitely beats performance in this case!
Best, Alex
OK, I got confused by the two closed PRs. Great if things are working already. I think it is easier if you do the changes for the Mammen weights on your end. I might contribute a (faster) C++ version once the upcoming {dqrng} release is on CRAN.