I've searched all over the place and I can't seem to find a solution to my problem. I have an array that contains how many times my random walk lands on a specified location. Now I need to find the sum of this array but for some reason the sum always gives 1000:(
int[] hx;
hx = new int[1000];
int hx_sum = 0;
for (int i = -500; i < 500; i++) {
hx[i+500] = totals.get(i);
}
for(int w = 0; w < 1000; w++){
hx_sum += hx[w];
}
System.out.print(hx_sum);
}
The result of my hx_sum is ALWAYS = 1000.
totals.get(i), that's what's filling your array.NBR_WALKS, but maybe there is some other function of the hash map that would mean what you want.