Well, the above is running fine here (compiles with VC8). You might want to initialize each and every variable thoroughly though, e.g.

```
int _tmain(int argc, _TCHAR* argv[])
{
int Counter = 0;
int Counter2 = 0; // <--
int Counter3 = 0; // <--
int n = 100000;
int fj[20] = {0};
memset(fj,0,20 * sizeof(int)); // <--
double Divisor = 1.0; // <--
double Z0 = 1;
double Zi = 0.0; // <--
double ZiMinusOne = 0.0; // <--
double Ui = 0.0; // <--
double TwoPowerThirtyOne = 0.0; // <--
TwoPowerThirtyOne = pow((double)2,31);
double v[100000];
memset(v,0,100000 * sizeof(double)); // <--
while (Counter < n+1){
if (Counter == 0)
ZiMinusOne = Z0;
else
ZiMinusOne = Zi;
Divisor = (floor( 16807*ZiMinusOne/(TwoPowerThirtyOne-1)));
Zi = 16807*ZiMinusOne - (Divisor) * (TwoPowerThirtyOne-1);
Ui = Zi/(TwoPowerThirtyOne-1);
v[Counter] = Zi;
Counter++;
}
for (Counter2 = 0; Counter2 < n-1; Counter2++){
for (Counter3 = 0; Counter3 < 20; Counter3++){
if (v[Counter2] >= Counter3*TwoPowerThirtyOne/20 && v[Counter2] <= (Counter3+1)*TwoPowerThirtyOne/20)
fj[Counter2]++;
}
}
for (Counter2 = 0; Counter2 < n-1; Counter2++)
cout << "fj" << Counter2 << ": " << fj[Counter2] << endl;
system ("PAUSE");
}
```