Skip to content
Prev 3109 / 10988 Next

[Rcpp-devel] RInside constructor calls srand

Hi Dirk:

Thanks for the quick reply.
On Sat, Nov 5, 2011 at 11:06 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

            
I tried something like this:

#include <stdlib.h>
#include <iostream>
#include <Rcpp.h>
#include <RInside.h>

using namespace std;

int main() {
	srand(1);
	RInside r(0, NULL);
	r.parseEvalQ("set.seed(0)");
	cout << rand() << endl;
	return 0;
}

But every time I run the program, I get a different random number. Am
I missing something?
Love the signature.


Joseph