[問題類型]:
程式諮詢(我想用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