Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Steve Grubb
On Friday, September 21, 2018 5:28:38 PM EDT Ralf Stubner wrote: > On 9/21/18 6:38 PM, Tierney, Luke wrote: > > Not sure what should happen theoretically for the code in vseq.c, but > > I see the same pattern with the R generators I tried (default, > > Super-Duper, and L'Ecuyer) and with with bash

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Steve Grubb
On Friday, September 21, 2018 12:38:15 PM EDT Tierney, Luke wrote: > Not sure what should happen theoretically for the code in vseq.c, but > I see the same pattern with the R generators I tried (default, > Super-Duper, and L'Ecuyer) and with with bash $RANDOM using > > N <- 1 > X1 <- replicate

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Ralf Stubner
On 9/21/18 6:38 PM, Tierney, Luke wrote: > Not sure what should happen theoretically for the code in vseq.c, but > I see the same pattern with the R generators I tried (default, > Super-Duper, and L'Ecuyer) and with with bash $RANDOM using > > N <- 1 > X1 <- replicate(N, as.integer(system("bas

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Tierney, Luke
Not sure what should happen theoretically for the code in vseq.c, but I see the same pattern with the R generators I tried (default, Super-Duper, and L'Ecuyer) and with with bash $RANDOM using N <- 1 X1 <- replicate(N, as.integer(system("bash -c 'echo $RANDOM'", intern = TRUE))) X2 <- replicat

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Dirk Eddelbuettel
Slightly nicer version: --- snip #include // [[Rcpp::export]] Rcpp::DataFrame stevePlot(Rcpp::NumericVector itable) { size_t cnt = itable.size(), num = 0; double nth, n1th = 0, n2th = 0, n3th = 0; double x, y, usex, use

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Dirk Eddelbuettel
On 21 September 2018 at 09:50, Steve Grubb wrote: | Hello, | | Top posting. Several people have asked about the code to replicate my | results. I have cleaned up the code to remove an x/y coordinate bias for | displaying the results directly on a 640 x 480 VGA adapter. You can find the | code

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Radford Neal
> Duncan Murdoch: > > and you can see it in the original m with > >x <- sample(m, 100, replace = TRUE) >plot(density(x[x %% 2 == 0])) OK. Thanks. I see there is a real problem. One option to fix it while mostly retaining backwards-compatibility would be to add extra bits from a sec

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Steve Grubb
Hello, Top posting. Several people have asked about the code to replicate my results. I have cleaned up the code to remove an x/y coordinate bias for displaying the results directly on a 640 x 480 VGA adapter. You can find the code here: http://people.redhat.com/sgrubb/files/vseq.c To collect

Re: [Rd] Bias in R's random integers?

2018-09-21 Thread Ralf Stubner
On 9/20/18 5:15 PM, Duncan Murdoch wrote: > On 20/09/2018 6:59 AM, Ralf Stubner wrote: >> It is difficult to do this in a package, since R does not provide access >> to the random bits generated by the RNG. Only a float in (0,1) is >> available via unif_rand(). > > I believe it is safe to multipl