On 1 September 2011 at 17:35, Zhongyi Yuan wrote:
| On Thu, Sep 1, 2011 at 2:35 PM, Dirk Eddelbuettel wrote:
|
| Please do not abuse this list as a substitute for doing your independent
| study and reading.
|
| Thanks Dirk and sorry for causing such feeling. That makes me guilty. Really
On Thu, Sep 1, 2011 at 2:35 PM, Dirk Eddelbuettel wrote:
>
> Please do not abuse this list as a substitute for doing your independent
> study and reading.
>
Thanks Dirk and sorry for causing such feeling. That makes me guilty. Really
hesitated before I asked...
Zhongyi
>
> Dirk
>
>
> | Zhongy
t; SetSeed(Named("seed",20) );
>
> RandCol=rnorm(NumRands,2,1);
>
> int j=3;
>
> for(int i=0; i
> RandVals(i,j) = RandCol(i);
>
> }
>
> return RandVals;
>
> '
>
> fun <- cxxfunction(signature(),
>
> src, plugin = "Rcpp")
>
&g
1 Sep 2011 12:06:53 -0500
>From: Zhongyi Yuan
>Subject: [Rcpp-devel] repeatable random numbers
>Hello everyone,
>I am conducting some numerical studies that I want to be repeatable. In
>other words, I want others who run my code to get exactly the same
result as
>I get.
>This
On 1 September 2011 at 14:23, Zhongyi Yuan wrote:
| If there is a seed set in R before rngs() is called, then "RNGScope z;" can be
| omitted, right?
Don't think about it this way. Think about properly initializing the state of
the RNG, and instantiating a local RNGScope variable does that. Which
If there is a seed set in R before rngs() is called, then "RNGScope z;" can
be omitted, right?
I used to use RNGScope() to set seed. I guess that is not the right way, is
it?
My test shows, with RNGScope(), even if I re-compile (without quitting R),
rngs always gives the same numbers. I have to q
Thank you for the quick reply, Dirk.
Zhongyi
On Thu, Sep 1, 2011 at 12:13 PM, Dirk Eddelbuettel wrote:
>
> On 1 September 2011 at 12:06, Zhongyi Yuan wrote:
> | Hello everyone,
> |
> | I am conducting some numerical studies that I want to be repeatable. In
> other
> | words, I want others who r
I should have written that quick function as follows:
rngs <- cxxfunction(signature(), plugin="Rcpp",
body="RNGScope z; return Rcpp::rnorm(5,0,1);")
You _do_ want RNGScope around; my bad for omitting it in the previous post.
Dirk
--
Two new Rcpp master classes for R
On 1 September 2011 at 12:06, Zhongyi Yuan wrote:
| Hello everyone,
|
| I am conducting some numerical studies that I want to be repeatable. In other
| words, I want others who run my code to get exactly the same result as I get.
| This can be easily done in pure R.
|
| But since I want the rand
Hello everyone,
I am conducting some numerical studies that I want to be repeatable. In
other words, I want others who run my code to get exactly the same result as
I get.
This can be easily done in pure R.
But since I want the random number generation in Cpp, I think I need a seed
that can be re
10 matches
Mail list logo