An excellent example of why you **ALWAYS** read the function documentation when coding in R (and other languages). Know how your tools work.
If that 1st argument is an integer > 1, the behavior is different from what sample() does otherwise.
So yes, it's a feature, not a bug.
R users, watch out for this somewhat infuriating behaviour of the sample() function.
R documentation says this is a feature, not a bug.