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] 1.905956
z$double(10)
#>  [1] -0.6728385 -1.0629114  1.6336832  0.5408304  1.4568580 -1.9337842
#>  [7] -0.8804008 -0.7977302 -0.8861310 -0.2948278
z$double(10, mean = 100)
#>  [1]  99.11335 100.09908 100.72055 101.00047 100.52800 101.16361 100.17314
#>  [8] 100.57792  99.88399 100.90452
z$double(10, mean = 100, sd = 17)
#>  [1]  99.71803  84.32094  81.97805  69.61761  81.86862  80.79290 106.58355
#>  [8] 121.59448  72.01600  97.89873

z$integer()
#> [1] 614
z$integer(10)
#>  [1] 576 893 813 351 386 980 933 470 376 224
z$integer(10, 1, 20)
#>  [1]  3  8  8  1 16 11  3 15  2 12
z$integer(10, 1, 10000000L)
#>  [1] 3555781 4410714 8623335 2945807 3912207 6792258 3393426 4135237 6387088
#> [10] 5069504

z$unif()
#> [1] 7827.189
z$norm()
#> [1] 0.08334721
z$lnorm(10)
#>  [1] 2.5023149 0.7718591 1.9680156 0.6569806 2.8496763 0.2129759 0.3513383
#>  [8] 0.1030367 0.7285843 0.2285065
z$beta(10, 1, 1)
#>  [1] 0.3345105 0.8340481 0.9346687 0.4715570 0.1968304 0.8390227 0.5005774
#>  [8] 0.4595838 0.6416752 0.6634866