search for: do_sample2

Displaying 2 results from an estimated 2 matches for "do_sample2".

Did you mean: do_sample
2015 Sep 09
0
sample.int() algorithms
...han 1e+7, and I was straddling this boundary: sample.int <- function(n, size = n, replace = FALSE, prob = NULL) { if (!replace && is.null(prob) && n > 1e7 && size <= n/2) .Internal(sample2(n, size)) else .Internal(sample(n, size, replace, prob)) } do_sample2() takes the approach of taking a sample, and then checking if this sample is a duplicate. As long as the population size is much larger than numbers of samples, this will be efficient. This explains the check for "size <= n/2". But I'm not sure why the "n > 1e7" ch...
2019 Mar 01
1
issue with sample in R 3.6.0.
Hello, I think there is an issue in the sampling rejection algorithm in R 3.6.0. The do_sample2 function in src/main/unique.c still has 4.5e15 as an upper limit, implying that numbers greater than INT_MAX are still to be supported by sample in base R. Please review the examples below: set.seed(123) max(sample(2^31, 1e5)) [1] 2147430096 set.seed(123) max(sample(2^31 + 1, 1e5)) [1] 1 set.se...