Sample Random Integers from Particular Range in R (Example Code)

In this R tutorial you’ll learn how to draw random integers from a range.

Example: Draw Unique Random Integer Values from Interval without Replacement

set.seed(2893755)                 # Random seed for reproducibility
sample.int(n = 100, size = 20)    # Sample integers between 1-100
#  [1] 78  4 82 39 64 43  7 42 35 98 41 79 14 63 55 92 83 68 88 21

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top