First if I may a recommendation for a little bit better readability - change for loops to for(int j=0; j<n; ++j) and then you can change all [j-1] to [j]. This is better when you work with arrays - they always starts with index 0.
Also this part of the code at the end looks like forgoten copy-paste...thing. Remove first two lines.
And if you use out.open ("rwalk.txt"); then you should most probably use out.close (); when you no longer need to write in the file.
Last thing, be careful with second for loop where you have j<=10. This meens that you are working with numbers 1 to 10 (and then [j-1] converts it to 0-9) but you declared your vectors with 9 elements (0-8). So your program is working with memory outside the vector and it may be corrupting some other part of the program (or other program). Or at leas I think it is that way; I am not very familiar with vectors.
Also, you should probably use vector's functions as they will generate compile-time run-time errors in case of failure.
So instead of writing x[i] = x[i] + randx[i] you should write x.at(i) = x.at(i) + randx.at(i); at() would throw an exception if you were to try to index an element which is not in the vector's range, while [] would generate undefined behaviour.
> generate compile-time errors in case of failure.
> So instead of writing x[i] = x[i] + randx[i] you should write x.at(i) = x.at(i) + randx.at(i);
The error is not at compile-time, but run-time
.at() would throw an exception, but operator[] would generate undefined behaviour