I am trying to read Latent Dirichlet Allocation model for Topic modeling. But I am not able to understand how they sample values from a distribution, draw a distribution from a process. In particular drawing from Dirichlet distribution/process. I want to understand all these sampling using Matlab/R. Please suggest some book/references where I can read the theory part as well as implementation using Matlab/R. I have very basic knowledge of probability/statistics.

I want to learn from the basics of sampling and its implementation then move to LDA topic modeling .

thanks