Note to self:
From R 3.6.0, base R’s sample
function works differently. This is to fix a bug in the previous version of the function (which caused some integers to be generated more often than others). A side effect of this is that simulations run with sample()
before v3.6.0 will give different results from those run with >= v3.6.0.
For backward compatibility, you can add the following line to the top of the script:
RNGkind(sample.kind="Rounding")
To return sample
‘s behavior to the v3.6.0 default, use the following line of code:
RNGkind(sample.kind="default")
More details from this Revolutions blog post.