diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/markov.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/markov.h b/src/markov.h index 2fdaf16..2cb22ce 100644 --- a/src/markov.h +++ b/src/markov.h @@ -69,6 +69,8 @@ void generate_chain(char *file_path) for(int j = 0; j < ITEMS; j++) all += items_seen[i][j]; + if(all == 0) continue; + for(int j = 0; j < ITEMS; j++) chain[i][j] = (double)items_seen[i][j]/all; } |