This is a multivariate distribution, so you're actually generating vectors.
1. Randomly generate from one of (k) categories with probabilities (p_1,p_2,...,p_k). (This is easy enough. Generate a random number in [0,1], etc.) If category (j) is generated, produce the vector ((0,...0,1,0,...0))...