search for: multicarry

Displaying 20 results from an estimated 28 matches for "multicarry".

Did you mean: multicard
2008 Aug 19
1
RNGkind() state (PR#12567)
...; sessionInfo() R version 2.7.1 (2008-06-23) i386--netbsdelf locale: C attached base packages: [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base > set.seed(1); runif(1)?????????# check the default [1] 0.2655087 > RNGkind("Mar") > RNGkind() [1] "Marsaglia-Multicarry" "Inversion" > set.seed(1); runif(1)?????????# now check again [1] 0.006153224 > set.seed(1)???????????????????# save seed and RNGkind > q("yes") cafe-rozo> ?R R version 2.7.1 (2008-06-23) : etc [Previously saved workspace restored] > runif(1)??????????????...
2008 Aug 17
1
Wichmann-Hill Random Number Generator and the Birthday Problem
...duplication problem is the interesting birthday problem. If there are M possible numbers, randomly draw N numbers from them, the average number of dupilcations D = N(N-1)/2/M. For Knuth-TAOCP and Knuth-TAOCP-2002, M=2^30, since this modulus is used. D = 46566.12 for N=10M samples. For Marsaglia-Multicarry, Super-Duper and Mersene-Twister, M=2^32. D = 11641.53 for N = 10M samples. My testing results (see below) agree with above analysis. But for Wichmann-Hill, it wasn't. Wichmann-Hill's cycle is 6.9536e12 (refer to RNG help by ?RNG and Whichmann's correction in 1984). Thus M <= 6.9...
2008 Jul 07
0
RNGkind() state
...R. > sessionInfo() R version 2.7.1 (2008-06-23) i386--netbsdelf locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base > set.seed(1); runif(1) # check the default [1] 0.2655087 > RNGkind("Mar") > RNGkind() [1] "Marsaglia-Multicarry" "Inversion" > set.seed(1); runif(1) # now check again [1] 0.006153224 > set.seed(1) # save seed and RNGkind > q("yes") cafe-rozo> R R version 2.7.1 (2008-06-23) : etc [Previously saved workspace restored] > runif(1) # with a saved seed, Marsaglia-Mult...
2003 Oct 16
2
.Random.seed
...function, a random uniform and the current .Random.seed should be printed: test<-function(runs,seed){ .Random.seed<-seed for (i in 1:runs) { print(i) print(runif(1,0,1)) print(.Random.seed)} return(.Random.seed} Consider the following input/output: >RNGkind(kind="Marsaglia-Multicarry") > set.seed(20391) > seed1<-.Random.seed > seed1 [1] 401 -1607331462 -462081869 > test(2,seed1) [1] 1 [1] 0.4188851 [1] 401 -1607331462 -462081869 [1] 2 [1] 0.7713649 [1] 401 -1607331462 -462081869 [1] 401 -1607331462 -462081869 > seed1 [1...
2005 Nov 17
2
R questions
Dear Sir/Madam, I am a beginner in R. Here is my questions. 1. Can you give me one test for randomness (a name and descriptive paragraph is sufficient). 2. I have learned a uniform random number generator [e.g. not the algorithms: i)Wichmann-Hill, ii) Marsaglia-Multicarry, iii) Super-Duper (Marsaglia), iv) Mersenne-Twister, v) TAOCP-1997 (Knuth), or vi) TAOCP-2002 (Knuth)] . Is there any other method besides that? 3. How to generate 100 random standard normal deviates using the Box-Muller method for standard normal random deviates and sort the sequence, smallest to...
2023 Feb 16
0
User-defined RNG with the standalone Rmath library
I have two questions about using a user-defined random number generator (RNG) with the standalone Rmath library. The default RNG with the standalone Rmath library is the Marsaglia-multicarry generator, which has poor properties. The "R Installation and Administration" manual, in the section "The standalone Rmath library", states that: ``` A little care is needed to use the random-number routines. You will need to supply the uniform random number generator doub...
1999 Jun 12
0
Random numbers
Hi, I have a few questions about the RNG in R; apologies if these are dumb questions: 1. It is my understanding that, among the three types of random number generators available in R now, the best one is the Marsaglia Multicarry. Is this correct? 2. How does the best RNG in R compare (in terms of quality) to the RNG in SPlus? (based on Marsaglia's Super Duper)? Does the Super-Duper in SPlus pass the MTUPLE test? 3. When running simulations in R, why would I want to use any RNG that is not the Marsaglia-Multicarry?...
1999 Apr 28
1
R random number generator
R 0.64 on windows NT 4.0 Sometimes I got an error message by doing this > .Random.seed <- c(1, 1:2) > .Random.seed [1] 1 1 2 > runif(5) Warning: Wrong length .Random.seed; forgot initial RNGkind? set to Wichmann-Hill[1] 0.02253721 0.84832584 ........ Sometimes I do not get error message: > .Random.seed <- c(1, 1:2) > .Random.seed [1] 1 1 2 > runif(1) [1] 0.5641106 >
2002 Aug 12
1
set.seed
...d so that I can reproduce a simulation if it's necessary later. Using set.seed, I can certainly get reproducible results, but not the results I get on the first pass. Here's an example: # Generate a random number to initialize > runif(1) [1] 0.965875 > RNGkind() [1] "Marsaglia-Multicarry" "Kinderman-Ramage" > > # Save random seed > temp.seed <- .Random.seed > > # Proceed to generate random uniforms > runif(5) [1] 0.18734034 0.02723140 0.46396251 0.10602243 0.64362777 > > # try to reproduce this sequence > set.seed(temp.seed, "defaul...
2013 Oct 10
1
Replacing the Random Number Generator in Stand Alone Library
...tion about the random number generator used in the R StandAlone Math Library. The stand-alone library depends on the unif_rand() function for most simulated values, and this function is provided in the sunif.c file in the relevant directory. At present, this program implements the "Marsaglia-Multicarry" algorithm, which is described throughout the R documentation as: "A multiply-with-carry RNG is used, as recommended by George Marsaglia in his post to the mailing list 'sci.stat.math'. It has a period of more than 2^60 and has passed all tests (according to Marsaglia). The seed...
2012 Jan 27
2
The following code (using rgamma) hangs
...######################################## If I add the definitions of `get_seed` and `set_seed` from `src/nmath/standalone/sunif.c` to my code, then the hang disappears. ################################################ #define MATHLIB_STANDALONE #include <Rmath.h> /* A version of Marsaglia-MultiCarry */ static unsigned int I1=1234, I2=5678; void set_seed(unsigned int i1, unsigned int i2) { I1 = i1; I2 = i2; } void get_seed(unsigned int *i1, unsigned int *i2) { *i1 = I1; *i2 = I2; } int main(void) { set_seed(0, 0); rgamma(1, 1); } #############################################...
2008 Aug 14
2
[R] RNG Cycle and Duplication (PR#12540)
...NGkind(kind=3D"Knuth-TAOCP"); sum(duplicated(runif(1e7))); #return 46552 RNGkind(kind=3D"Knuth-TAOCP-2002"); sum(duplicated(runif(1e7))); #return 46415 #These collision frequency suggested there were 2^30 distinct values by=20 birthday problem. RNGkind(kind=3D"Marsaglia-Multicarry"); sum(duplicated(runif(1e7))); #return 11682 RNGkind(kind=3D"Super-Duper"); sum(duplicated(runif(1e7))); #return 11542 RNGkind(kind=3D"Mersenne-Twister"); sum(duplicated(runif(1e7))); #return 11656 #These indicated there were 2^32 distinct values, which agrees with the=...
2002 Nov 26
5
unexpected behaviour of rnorm()
Hello everyone. If I do f <- function(n){max(rnorm(n))} plot(sapply(rep(5000,4000),f)) #[this takes my PC about 30 seconds] then I get something quite unexpected: gaps in the distribution. For me, the most noticable one is at about 3.6. Do others get this? Is it an optical illusion? It can't be right, can it? Or maybe I just don't understand the good ol' Gaussian very
2000 Dec 14
0
using R's random numbers in another program
Dear All, I want to use R's random number in a C++ program (I can link libRmath either as shared or static library). I have two questions: 1. If I understand correctly, the underlaying random number generator will be Marsaglia-multicarry, UNLESS I provide my own. In other words (unless I provide it) I cannot use some of the other RNG's available from within R, such as Mersenne-Twister? 2. I am using another library, which uses it own RNG; I guess there is no problem in using both R's RNG's (for some of the functions...
2001 Oct 18
0
uniform generator (default)
Recieving digests. > RNGkind(NULL) [1] "Marsaglia-Multicarry" "Kinderman-Ramage" I would appreciate it if anybody has any comments on the following. Please do not comment on the R functions themselves, since they merely mimic a (bivariate simplification of a) C routine called from S. In particular, I would like to know if anything is availab...
2003 Jun 13
0
Testing the R RNGs
...l Crush", "Crush" and "Big Crush". If a particular RNG fails Small Crush, there is no need to apply Big Crush. Below I summarize the results: Number of Tests Failed Small Crush Crush Big Crush Wichmann-Hill 1 3 NA Multicarry 1 13 NA Super-Duper 1 9 NA Mersenne -- -- -- TAOCP 0 0 0 TAOCP-2002 0 0 0 NA: Not Applied because not neces...
1999 Apr 29
0
Problems with setting .Random.seed (PR#179)
...h 3, where each `r[i]' is in `1:p[i]', where `p' is the length 3 vector of primes, `p = (30269, 30307, 30323)'. The This should be (and will be) 1:(p[1] - 1). (3) The help page now says what the length of the seed is and the restrictions for the "Marsaglia-Multicarry" and "Super-Duper" kinds and corrects the description of the latter. Brian -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks R...
1999 May 04
1
rnorm
Brian I've been playing a bit with the Wichmann-Hill RNG. I would prefer to have normally distributed random numbers and I think I have things generally worked out to use Wichmann-Hill and then Box-Muller. In the process, I was looking at R's rnorm.c, but could not figure out what transformation is used in R to convert uniform rv's to normal rv's. Do you know? It looks like there
2000 Jan 19
1
random number generator
This question may not be specific to R, but I'm using R so here goes: Since R is slow (as is Splus) I want to split a simulation and run it on 2 or 3 systems at once. The simulations involve generating a large number of random values. How can I set .Random.seed so that the succession of random values don't overlap across systems. I see that when I invoke R and give command runif(1) a
2002 Aug 12
0
help with pseudo-random numbers
...#39;d appreciate comments, even comments telling me how misguided my attempts are. :-) However, I would particularly appreciate comments about 1) and 2), and if you think they are reasonable, tell me 1') What two random number generators should I use? I believe the R default is "Marsaglia-Multicarry". 2') What should I take N to be? Clearly, I'd like to make it as small as possible. Any other suggestions you think would be better would also be gratefully received. Now, I have another question relating to how I could actually implement the above scenario. The context in which I...