search for: set_seed

Displaying 11 results from an estimated 11 matches for "set_seed".

2012 Jan 27
2
The following code (using rgamma) hangs
...b. I reported it to the Debian BTS as http://bugs.debian.org/657573 I'm using Debian squeeze, and the code was tested with r-mathlib 2.11.1-6 (default on stable) and 2.14.1-1 (from testing/unstable). I summarize this report below. The following code with the R math library hangs. Note that set_seed is defined as taking two unsigned int arguments, so 0's are valid arguments. I'm guessing that since 0 is as low as an unsigned integer can go, it represents some kind of edge case. ################################################ #define MATHLIB_STANDALONE #include <Rmath.h> int...
2011 Aug 04
1
How to seed the R random number generator in C (standalone) with an instance of .Random.seed
hello all, I use the R standalone math library in my own C program, and the default R random number generator can be seeded with set_seed(const unsigned int, const unsigned int). How could I seed the RNG with an instance of .Random.seed ? I would need this or a similar workaround for debugging purposes. More precisely, I use the default R random number generator to sample from various distributions in my own C code SEED<- .R...
2000 Mar 07
3
set_seed
Dear Sir, I would like to set seed in R before this command >B <- 10 >x <- rnorm(15) for (i in 1:B) {boot.sample <- print(sample(x,replace=T)) } ... > for reason of stable of data output. How I do ? Best Regards, Nikom Thanomsieng Department of Biostatistics & Demography, Faculty of Public Health, Khon Kaen University, Thailand.
2002 Jan 24
2
random number generation issues with r and compiled C code
Dear People, I have been writing a simulation routine that is currently entirely written in c++. I've been using the R standalone math library to give me random number generation for this. However, I have had to set the seed myself, and I am using set_seed(time(NULL), clock) for every call to unif_rand(). However, this works really badly. The random numbers aren't uniform at all. Does anyone have better suggestions? I think the problem is that every time I call the random number generation function, I have to set the seed, and this messes up t...
2006 Mar 03
1
Fwd: Re: calling R's library using C
...hould have had the functions in > libR.so (but I did not know where to look) led me astray. I am sure it is all > my fault. Anyway, the fact of the matter is that because if I include that > library (and define that MATH_STANDALONE), I get errors: in particular, it > would not recognize set_seed (which is a function which should work only if > that is included). So, something was clearly long. After spending all of > Thursday on this, I decided to post back. > > Thanks again for your missive. While I would appreciate the pertinent manual > (English is not my strong suit, bu...
2002 Jan 14
1
trouble using R Mathlib as standalone
Dear People, I am trying to use R's Math library as standalone, as documented in /src/nmath/standalone. I am using C++ in Debian testing, and the versions are as follows: ii g++-3.0 3.0.3-1 The GNU C++ compiler. ii r-mathlib 1.4.0-1 `GNU S' - Standalone R math library I have a file (rand.cc) as follows. I don't think that lattice.hh or mh.hh are very
2023 Feb 16
0
User-defined RNG with the standalone Rmath library
...ittle care is needed to use the random-number routines. You will need to supply the uniform random number generator double unif_rand(void) or use the one supplied (and with a shared library or DLL you may have to use the one supplied, which is the Marsaglia-multicarry with an entry point set_seed(unsigned int, unsigned int) to set its seeds). ``` I interpret this to mean that we cannot use a user-defined random number generator with "a shared library or DLL", which suggests using static linking. Question: are there any good examples of re-defining unif_rand() with the standalon...
2008 Jan 02
1
setting the seed in standalone code using Rlib
..., "set.seed(%u)", seed); PROTECT(cmdSexp = allocVector(STRSXP, 1)); SET_STRING_ELT(cmdSexp, 0, mkChar(cmd)); cmdExp = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue)); assert(status == PARSE_OK); eval(VECTOR_ELT(cmdExp, 0), R_GlobalEnv); UNPROTECT(2); #else set_seed(seed, seed); #endif } /* Test */ extern int Rf_initEmbeddedR(int argc, const char *argv[]); int main(int numArgs, char** args) { const char *argv[]= {"setseed", "--gui=none", "--silent"}; const int argc = 3; Rf_initEmbeddedR(argc, argv); setSeed((unsigne...
2000 Dec 08
1
nmath bug (PR#762)
...ection step in rpois can result in an infinite loop. The simplest thing I can come up with that reproduces the problem is the following. #include <stdio.h> #include <math.h> #include <time.h> #define MATHLIB_STANDALONE #include "Mathlib.h" int main() { double d; set_seed(976259805U,2968367341U); for(long k=0; k<10; k++) { for(long k=0; k<10000; k++) d = rpois(4500); for(long k=0; k<250000; k++) d = rpois(100); printf("."); fflush(stdout); } } Fro me this prints 3 dots and then hangs. I realize calling rpois with means this...
2003 Dec 14
1
compile error with C code and standalone R math C library
...(double *node, int *current_pos); double new_val(double *node, double theta, int current_pos); double accept_prob(double *node, double theta, int current_pos); double accept_prob_fn(double a, double y); int main() { int currentpos = 0; int i; double newval, node[T+2], theta = THETA, p, u; set_seed(time(NULL), clock()); node[0]=0; for(i=1;i<=T;i++) node[i]= INITVAL; /* for simplicity choose all values the same */ node[T+1]=0; for(i=0; currentpos < T; i++) { u = unif_rand(); newval = new_val(node, theta, currentpos); p = accept_prob(node, theta, curr...
2006 Sep 26
15
RE: Individual passwords for guest VNC servers ?
> Thanks all point about security, I''ll do as follows. > I thought that the point was the following two. > > > 1. Storage place of encrypted password > Should I store it in /etc/xen/passwd ? > Or, should I wait for DB of Xen that will be released in > the future? The xend life cycle management patches were posted by Alistair a couple of months back.