#include double BoxMuller; int BoxMullerFlag; #define N 500 double c[N],x[N],xp[N],s[N],sp[N]; double drand48(); #define TwoPi=6.283185307 double norm() { double fac,r,v1,v2; if(BoxMullerFlag==0){ do { v1=2.0*drand48()-1.0; v2=2.0*drand48()-1.0; r=v1*v1+v2*v2; } while(r>=1.0); fac=sqrt(-2.0*log(r)/r); BoxMuller=v1*fac; BoxMullerFlag=1; return(v2*fac); } else { BoxMullerFlag=0; return(BoxMuller); } } rhs(double g,double a, double sig, double tau, double dt,double st) { int i; for(i=0;i