How to generate truncated Dirichlet distribution

I am interested in generating numbers from a truncated Dirichlet distribution, upperly bounded by a certain value. As a simple example:



This code generates 10 random numbers from the Dirichlet distribution with all concentration parameters set to 1.

Does anyone know how could I do the same, truncating the distribution by an upper bound ub?

Thanks in advance for any help!

With all parameter being 1, this example really becomes oversimplified. Now it's just a multivariate uniform distribution, where components are independent. So you can draw univariate uniform in desired range as well.

In general case, I suppose you can go for inverse cdf method, if you have a function to get quantiles (multivariate quantile). There may be other better ways, this is just what comes to my mind immediately.