[问题] R套件C random number问题

楼主: dorminia (重新出发)   2019-02-21 11:36:12
[问题类型]:
程式咨询(我想用R 做某件事情,但是我不知道要怎么用R 写出来)
[软件熟悉度]:
开发者(有撰写R 的套件经验)
[问题叙述]:
我有个套件要上传,里面有包Rcpp的部分,但被CRAN回传说
不能有rand()。回传讯息举例如下:
Found 'rand', possibly from 'rand' (C)
Object: 'HMMfit.o'
想问一下要怎么改 @@
[程式范例]:
inline double randomchisq (double df){
std::default_random_engine generator(rand());
std::chi_squared_distribution<double> distribution (df);
return (distribution(generator));
}
[环境叙述]:
R version 3.5.2 (2018-12-20)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
作者: clickhere (It's time to go home.)   2019-02-23 09:19:00
改用 Rmath.h 中的 RNG function.

Links booklink

Contact Us: admin [ a t ] ucptt.com