MarkG:
You have an array...int x[] = {}; // empty arrayExactly. It can hold ZERO elements.
you make a random number between 50 and 200
long y = random(50, 200);OK. Useless, but, hey, it's your story.
you run a loop to then fill that array with a random number where the loop is 50 to 200 numbers
for(int c=0; c<=y-50; c++){
x[c] = random(1, 10);// stick a random number in it 1 to 10
}
Doing that is stupid, because there is space in the array for ZERO elements. You've, therefore, written over space that you don't own. That often has disastrous results. When I run that in the Arduino to verify it, I get no errors. Happy? Yeah, but you won't be if you keep this crap up.