simulation function for random intercept model