I would like to produce synthetic survey data. At the moment I produce independent answers between questions according to an arbitrary discrete distribution [as in this question][1]. 


I want to generate randomly and independently answers to 2 different questions with categorical responses. 

I want to then generate an answer to a third question which depends on the first two answers. 

How can this be done for a continuous valued case? 

How can this be done for a categorical case? 

I am more interested in how to do the discrete case where a new (dependent) categorical results is produced.  		 

I am interested in any type of dependency which would show up when measuring the mutual information between question answers. Having maybe 2 or 3 category numbers.

  [1]: http://stats.stackexchange.com/questions/26858/how-to-generate-numbers-based-on-an-arbitrary-discrete-distribution