rcat {SBMSplitMerge}R Documentation

Draw draw Categorical distribution

Description

Draw draw Categorical distribution

Usage

rcat(n, p, replace = TRUE)

Arguments

n

number of draws

p

a length-d probability vector

replace

should the categories be replaced? If so n < p required

Value

a draw from Categorical(p)

Examples

rcat(1, 1) ## returns 1 with probability 1
rcat(1, rep(1/6,6)) ## a dice roll

[Package SBMSplitMerge version 1.1.1 Index]