$ gdb a.out
Program received signal SIGSEGV, Segmentation fault.
0x00000000004013d6 in main () at ANN.cpp:181
181 Accum += Input[p][j] * HiddenWeights[j][i] ;
(gdb) print p
$1 = 566
p = RandomizedIndex[q]; //172
RandomizedIndex is filled from 0 to size-1 and then shuffled, however your shuffle
1 2 3 4 5 6 7
for( p = 0 ; p < PatternCount ; p++) {
q = rand() % PatternCount + 1; //¿why +1? Range [1;size]
//q = random(PatternCount);
r = RandomizedIndex[p] ;
RandomizedIndex[p] = RandomizedIndex[q] ; //possible out of bounds
RandomizedIndex[q] = r ;
}