Skip to contents

numeric methods, generate numbers

Super class

charlatan::BareProvider -> NumericsProvider

Methods

Inherited methods


Method double()

get a double, pulls from normal distribution

Usage

NumericsProvider$double(n = 1, mean = 0, sd = 1)

Arguments

n

(integer) number of values, default: 1

mean

mean value, default: 0

sd

standard deviation, default: 1


Method integer()

get an integer, runs sample() on range given

Usage

NumericsProvider$integer(n = 1, min = 1, max = 1000)

Arguments

n

(integer) number of values, default: 1

min

minimum value, default: 1

max

maximum value, default: 1000


Method unif()

get numbers from the uniform distribution

Usage

NumericsProvider$unif(n = 1, min = 0, max = 9999)

Arguments

n

(integer) number of values, default: 1

min

minimum value, default: 1

max

maximum value, default: 1000


Method norm()

get numbers from the normal distribution

Usage

NumericsProvider$norm(n = 1, mean = 0, sd = 1)

Arguments

n

(integer) number of values, default: 1

mean

mean value, default: 0

sd

standard deviation, default: 1


Method lnorm()

get numbers from the lognormal distribution

Usage

NumericsProvider$lnorm(n = 1, mean = 0, sd = 1)

Arguments

n

(integer) number of values, default: 1

mean

mean value, default: 0

sd

standard deviation, default: 1


Method beta()

get numbers from the beta distribution

Usage

NumericsProvider$beta(n = 1, shape1, shape2, ncp = 0)

Arguments

n

(integer) number of values, default: 1

shape1

non-negative parameters of the Beta distribution

shape2

non-negative parameters of the Beta distribution

ncp

non-centrality parameter, default: 0


Method clone()

The objects of this class are cloneable with this method.

Usage

NumericsProvider$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

z <- NumericsProvider$new()

z$double()
#> [1] -0.7904276
z$double(10)
#>  [1]  0.75848016  2.07837562  1.91913490  0.07552982  0.26775153  0.43629074
#>  [7]  1.20974878 -1.25305556  1.76502863 -0.15932203
z$double(10, mean = 100)
#>  [1] 100.89887  99.29500 101.12690  98.02568  98.75523 101.03125 100.57910
#>  [8]  98.96211 101.56162 100.10196
z$double(10, mean = 100, sd = 17)
#>  [1] 139.51205 139.53948  78.01645  99.23468 103.32680 108.17060 134.29482
#>  [8] 120.32535 111.16178 117.44706

z$integer()
#> [1] 724
z$integer(10)
#>  [1] 104 616 160 968 628 405 305 706 691 662
z$integer(10, 1, 20)
#>  [1]  5 17  6  6  7 19  9 14  6  7
z$integer(10, 1, 10000000L)
#>  [1] 9978813 2183305 3527149  470969 8284400 9396093 7842472 6437681 3168009
#> [10] 6596949

z$unif()
#> [1] 5597.082
z$norm()
#> [1] 0.8919746
z$lnorm(10)
#>  [1] 0.6960371 0.8616938 1.6057145 2.8624813 2.3885362 0.2565002 1.7535319
#>  [8] 0.9444906 1.3055869 0.8067946
z$beta(10, 1, 1)
#>  [1] 0.97926836 0.02445234 0.32075872 0.95024362 0.84223617 0.22398296
#>  [7] 0.24510131 0.35306940 0.01013546 0.13282015