I think you need to carefully specify the statistical model from which you are trying to simulate. Presumably the random effect is changing some aspect of the model that varies between subjects. You need to specify what changes between subjects and how it changes. For each subject, you can draw a pair of observations. Then generate new parameters for the next subject, and repeat. If that process sounds like what you are trying to acheive, then you do not need to change any functions. You would loop over subjects and generate the PMF (P) and correlation for that subject, simulate from those parameters, and move on to the next subject.
... View more