>>>>> Wolfgang Huber >>>>> on Thu, 20 Sep 2018 08:47:47 +0200 writes:
> FWIW, I suspect this is related to the function > R_unif_index that was introduced in src/main/RNG.c around > revision 72356, or the way this function is used in > do_sample in src/main/random.c. Yes, it is just the use of 'dn' instead of 'n' - a one letter thinko I'd say. But *no*, it's much older than revision 72356; e.g., it's already in R version 3.0.0 (2013-04-03) -- "Masked Marvel" but not yet in R version 2.15.3 (2013-03-01) -- "Security Blanket" ---- Here, I clearly think we see a regression bug, and hopefully not one that should trigger often in practice... and -- without any statistics about the consequences out in package space -- I do think we should fix this in code and let the documentation become "great again" ;-) Martin > 20.9.18 08:19, Wolfgang Huber scripsit: >> Besides wording of the documentation re truncating vs >> rounding, there is something peculiar going on with the >> fractional part of n: >> >> > table(sample.int(2.5, 1e6, replace = TRUE)) >> >> 1 2 3 399051 401035 199914 >> >> > table(sample.int(3, 1e6, replace = TRUE)) >> >> 1 2 3 332956 332561 334483 >> >> > table(sample.int(2.01, 1e6, replace = TRUE)) >> >> 1 2 3 497173 497866 4961 >> ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel