random_number: Random Number Generator

Description Usage Arguments Value Examples

Description

This function allows you to generate your desired number of random numbers from your chosen distribution.

Usage

1
2
random_number(num, distribution, mu = NULL, sigma = NULL,
  trials = NULL, p = NULL, l = NULL)

Arguments

num

Number of required output

distribution

Distribution of output. Should be one of "normal", "binomial", "poisson"

mu

Required for NORMAL distribution only - distribution mean

sigma

Required for NORMAL distribution - distribution standard deviation

trials

required for BINOMIAL distribution - number of yes/no trials in the test

p

required for BINOMIAL distribution - probability of success (i.e. 'yes' outcome)

l

required for POISSON distribution - lambda is the rate perameter (i.e. events per interval of time)

Value

random numbers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
x_n <- random_number(num = 5, distribution = "normal",
                     mu = 0, sigma = 1,
                     trials = NULL, p = NULL,
                     l = NULL)
x_b <- random_number(num = 5, distribution = "binomial",
                     mu = NULL, sigma = NULL,
                     trials = 10, p = 0.5,
                     l = NULL)
x_p <- random_number(num = 20, distribution = "poisson",
                     mu = NULL, sigma = NULL,
                     trials = NULL, p = NULL,
                     l = 5)
summary(x_n)
summary(x_b)
summary(x_p)

SassyData/randnumr-package documentation built on May 10, 2019, 12:03 a.m.