generate_random_number: Random Number Generator

View source: R/generate_random_number.R

generate_random_numberR Documentation

Random Number Generator

Description

generate_random_number draws a random number(s) from a range either as an integer or a float with a specified number of decimal digits

Usage

generate_random_number(
  n = NULL,
  min = NULL,
  max = NULL,
  type = "integer",
  digits = NULL
)

Arguments

n

numeric; a numeric value that specifies the number of random numbers the user would like returned

min

numeric; a numeric value that specifies the minimum number in the range to draw from

max

numeric; a numeric value that specifies the maximum number in the range to draw from

type

string; a string that must be either "integer" or "float", specifies the format of the desired, numeric output as either an integer or float value

digits

optional numeric; a numeric value to accompany type = "float" and specify the number of decimal digits to include

Examples

generate_random_number(n = 1, min = 1, max = 10, type = "integer")

generate_random_number(n = 2, min = 1, max = 10, type = "float", digits = 3)

generate_random_number(
  n = 3, min = 1, max = 10, type = "float", digits = "5"
  )

mike-decarlo/caser documentation built on March 14, 2023, 9:54 a.m.