Learn R Programming

DescTools (version 0.99.56)

rSum21: Random Numbers Adding Up to 1

Description

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

Usage

rSum21(size, digits = NULL)

Value

a vector of length size with elements drawn

Arguments

size

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

digits

integer indicating the number of decimal places to be used.

Author

Andri Signorell <andri@signorell.net>

See Also

runif, (Dirichlet distribution)

Examples

Run this code
# generate 5 numbers
x <- rSum21(5)
sum(x)

Run the code above in your browser using DataLab