raster (version 1.0.4)

SampleInt: Sample integer values

Description

Take a random sample from a range of Integer values between 1 and n. Its purpose is similar to that of sample.int, but that function fails when n is very large.

Usage

sampleInt(n, size)

Arguments

n
a non-negative integer, the number of items to choose from
size
positive integer giving the number of items to choose.

Value

  • vector of numeric (representing integer numbers)

Examples

Run this code
sampleInt(1e+12, 10)
  
# this may fail:
#  sample.int(1e+12, 10)
#  sample.int(1e+9, 10)

Run the code above in your browser using DataCamp Workspace