Skip to contents

numeric methods, generate numbers

Super class

charlatan::BaseProvider -> 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.100637
z$double(10)
#>  [1] -0.1762160 -0.7755324  0.6460795  1.1854533  1.1059711 -1.3830692
#>  [7]  0.3607461  1.9837308  0.7030805  0.3223404
z$double(10, mean = 100)
#>  [1]  99.26386 100.92543 100.02248 100.43882  99.81035  98.94781 100.56092
#>  [8]  99.38064 100.72872  98.19701
z$double(10, mean = 100, sd = 17)
#>  [1]  79.17019  61.97496 122.33597 111.96383 147.30464 116.01138 114.44807
#>  [8] 100.51965 103.98325  91.62923

z$integer()
#> [1] 272
z$integer(10)
#>  [1] 346 409 525 970 967 555 518 364 497 532
z$integer(10, 1, 20)
#>  [1]  7 11 18 14  8  4 11 15 20  4
z$integer(10, 1, 10000000L)
#>  [1] 6682705 4996657 3660836 5679635 3383176 9663176 9065521 9030513 6723482
#> [10] 5926754

z$unif()
#> [1] 3568.147
z$norm()
#> [1] 2.234025
z$lnorm(10)
#>  [1]  0.3544324  2.1104438  2.3735381  0.4979741  0.2421386  0.7017915
#>  [7]  8.0642186  2.1193485  0.9608720 10.4047043
z$beta(10, 1, 1)
#>  [1] 0.16972989 0.94356301 0.33576618 0.49204581 0.88755264 0.02491335
#>  [7] 0.55738752 0.96186427 0.02983940 0.54046309