Skip to content
Back to formatted view

Raw Message

Message-ID: <b2ed972b-d26f-5383-d5b2-3c8a5995955f@daqana.com>
Date: 2019-02-21T08:46:03Z
From: Ralf Stubner
Subject: [R-pkg-devel] Problem on rand() in packaging
In-Reply-To: <b099fd79-d2c6-9f54-edbf-e3083f0ebc1c@statistik.tu-dortmund.de>

On 21.02.19 09:16, Uwe Ligges wrote:
> Use R's RNG, see Writing R Extensions.

Which can be conveniently used with R::runif and Rcpp::runif etc. when
using Rcpp.

cheerio
ralf

> Best,
> Uwe Ligges
> 
> 
> On 21.02.2019 07:52, Chu-Lan Kao wrote:
>> Dear Sir,
>>
>> I've got a Rcpp code in the form like the following in my uploaded
>> package:
>>
>> inline double runiforminline(){
>> ?? std::default_random_engine generator(rand());
>> ?? std::uniform_real_distribution<double> distribution (0.0, 1.0);
>> ?? return (distribution(generator));
>> }
>>
>> But as I uploaded, the system ask me to remove rand(). Various attempt
>> has
>> been tried, but all of them result in no randomness at all. Not sure
>> how to
>> fix it. Kindly appreciate all helps.
>>
>> Sincerely,
>>
>> Chu-Lan Kao ( ??? Michael )
>> *http://chulankao.blogspot.com / <http://chulankao.blogspot.com/>*
>> ChuLanKao at gmail.com
>> <http://chulankao.blogspot.com%20/%20ChuLanKao at gmail.com> / 0956242509
>>
>> Assist. Prof. in Statistics, National Chiao-Tung University
>> Music Director for dramAcappella Theater
>> <https://www.facebook.com/dramAcappella>
>> Composer, Taipei Philaharmonic Chorus <http://www.tpf.org.tw/index.php>
>> Gamer Consultant and Designer
>>
>> ????[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
> 
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
Ralf Stubner
Senior Software Engineer / Trainer

daqana GmbH
Dortustra?e 48
14467 Potsdam

T: +49 331 23 61 93 11
F: +49 331 23 61 93 90
M: +49 162 20 91 196
Mail: ralf.stubner at daqana.com

Sitz: Potsdam
Register: AG Potsdam HRB 27966
Ust.-IdNr.: DE300072622
Gesch?ftsf?hrer: Dr.-Ing. Stefan Knirsch, Prof. Dr. Dr. Karl-Kuno Kunze


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-package-devel/attachments/20190221/3a3f9d5f/attachment.sig>