rSum21: Random Numbers Adding Up to 1

View source: R/DescTools.r

rSum21R Documentation

Random Numbers Adding Up to 1

Description

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

Usage

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(s)

Andri Signorell <andri@signorell.net>

See Also

runif, (Dirichlet distribution)

Examples

# generate 5 numbers
x <- rSum21(5)
sum(x)

DescTools documentation built on Sept. 26, 2024, 1:07 a.m.