Dynare 4.2.0 Error using Rand

The answer is not so easy. If you don’t have a recursive representation to get rid the integral by defining the whole thing as a variable (e.g. [How to include an integral in dynare code?)), you can only try a external function [Integration function - dynare v4?). Unfortunately, I don’t have experience with models like this. You may want to look at how Christiano/Motto/Rostagno (2014): RIsk shocks, AER dealt with this. They have replication files online.