diff options
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/test_rps.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 4c10133d2..00835794b 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -1994,9 +1994,17 @@ static void compute_probabilities (uint32_t peer_idx) | |||
1994 | if (0 != probs[i]) count_non_zero_prob++; | 1994 | if (0 != probs[i]) count_non_zero_prob++; |
1995 | } | 1995 | } |
1996 | /* normalize */ | 1996 | /* normalize */ |
1997 | for (i = 0; i < num_peers; i++) | 1997 | if (0 != count_non_zero_prob) |
1998 | { | 1998 | { |
1999 | probs[i] = probs[i] * (1.0 / count_non_zero_prob); | 1999 | for (i = 0; i < num_peers; i++) |
2000 | { | ||
2001 | probs[i] = probs[i] * (1.0 / count_non_zero_prob); | ||
2002 | } | ||
2003 | } else { | ||
2004 | for (i = 0; i < num_peers; i++) | ||
2005 | { | ||
2006 | probs[i] = 0; | ||
2007 | } | ||
2000 | } | 2008 | } |
2001 | /* str repr */ | 2009 | /* str repr */ |
2002 | for (i = 0; i < num_peers; i++) | 2010 | for (i = 0; i < num_peers; i++) |