Getting different results with set.seed()

There were some changes in R 3.6.0 related to how sample() works. From r-source/doc/NEWS.Rd at 7f6cc784523dfa69087958633f7deb309d9c8718 · wch/r-source · GitHub

\item The default method for generating from a discrete uniform
distribution (used in \code{sample()}, for instance) has been
changed. This addresses the fact, pointed out by Ottoboni and
Stark, that the previous method made \code{sample()} noticeably
non-uniform on large populations. See \PR{17494} for a
discussion. The previous method can be requested using
\code{RNGkind()} or \code{RNGversion()} if necessary for
reproduction of old results. Thanks to Duncan Murdoch for
contributing the patch and Gabe Becker for further assistance.

The output of \code{RNGkind()} has been changed to also return the
\sQuote{kind} used by \code{sample()}.

You may want to double-check what the output of RNGkind() is -- it's possible that you're loading an R package that is changing the requested random number generator.

To compare:

> RNGkind(sample.kind = "Rounding")
Warning message:
In RNGkind(sample.kind = "Rounding") : non-uniform 'Rounding' sampler used
> set.seed(1); sample(20)
 [1]  6  8 11 16  4 14 15  9 19  1  3  2 20 10  5
[16]  7 12 17 18 13
> 
> RNGkind(sample.kind = "Rejection")
> set.seed(1); sample(20)
 [1]  4  7  1  2 13 19 11 17 14  3 18  5  9 16  6
[16] 15 12 10 20  8
4 Likes