R/dirichletrnd.R

Defines functions dirichletrnd

Documented in dirichletrnd

dirichletrnd <- function(a,n) { 
  out <- matrix(nrow=n,ncol=length(a))  
  for (i in 1:n){
    y <- rgamma(length(a), a, 1)    
    out[i,] <- y / sum(y)
  }
  return(out)
}

Try the CEoptim package in your browser

Any scripts or data that you put into this service are public.

CEoptim documentation built on Oct. 4, 2023, 9:13 a.m.