R/rdirichlet.R

Defines functions rdirichlet

rdirichlet = function(n, alpha){
  l <- length(alpha)
  x <- matrix(stats::rgamma(l * n, alpha), ncol = l, byrow = TRUE)
  sm <- x %*% rep(1, l)
  x/as.vector(sm)
}
jonathantemplin/blatent documentation built on Jan. 26, 2024, 11:27 p.m.