Generates a vector of uniformly distributed random numbers which sum to 1.

rSum21(size, digits = NULL)

Arguments

size

a non-negative integer giving the number of numbers to generate.

digits

integer indicating the number of decimal places to be used.

Value

a vector of length size with elements drawn

Author

Andri Signorell <andri@signorell.net>

See also

runif, (Dirichlet distribution)

Examples

# generate 5 numbers
x <- rSum21(5)
sum(x)
#> [1] 1