Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Douglas Bates
As Dirk pointed out to me off-list, I shouldn't reply to email before coffee. It was my mistake - you had indeed used RNGscope properly. On Wed, Apr 13, 2011 at 8:27 AM, Cedric Ginestet wrote: > Thanks Douglas for being picky! > I have indeed noted that I needed to use b+1 in my codes to produce

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Cedric Ginestet
Thanks Douglas for being picky! I have indeed noted that I needed to use b+1 in my codes to produce discrete uniform variates. However, I am not too sure that I understand how to use RNGScope properly. I originally referred to the Rcpp Sugar codes provided in the Rcpp-introduction .pdf document

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Douglas Bates
On Wed, Apr 13, 2011 at 6:50 AM, Cedric Ginestet wrote: > Brilliant, Dirk. Thanks for that. > Next time, I'll read the Rcpp Sugar .pdf more carefully. > Cheers, Be aware that in both versions you will never return a vector containing b, which might be confusing. That is, the argument b should be

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Cedric Ginestet
Brilliant, Dirk. Thanks for that. Next time, I'll read the Rcpp Sugar .pdf more carefully. Cheers, On 13/04/11 12:43, Dirk Eddelbuettel wrote: On 13 April 2011 at 12:19, Cedric Ginestet wrote: | Hi guys, | | I want to produce discrete uniform variates within C++ from the runif() | function avai

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Dirk Eddelbuettel
On 13 April 2011 at 12:19, Cedric Ginestet wrote: | Hi guys, | | I want to produce discrete uniform variates within C++ from the runif() | function available through Rcpp Sugar. However, I don't seem to be able to find | the appropriate cast in order to return an IntegerVector as opposed to a |

[Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Cedric Ginestet
Hi guys, I want to produce discrete uniform variates within C++ from the runif() function available through Rcpp Sugar. However, I don't seem to be able to find the appropriate cast in order to return an IntegerVector as opposed to a numeric one. I have naively used int(), but this is clearly