X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mood.c;h=decc77fc74f407b901ac13b59e18afe32da308e5;hp=b65561d582e84a8e12ef57daa8523cce660d878a;hb=aea0aba712b2170e2d39ffa1c8f8cb55fc0881bf;hpb=f6f50d03a09d6bc423324206d274336e9905bbb4 diff --git a/mood.c b/mood.c index b65561d5..decc77fc 100644 --- a/mood.c +++ b/mood.c @@ -1,5 +1,6 @@ #include "para.h" #include "error.h" +#include "afh.h" #include "afs.h" #include "list.h" #include "string.h" @@ -235,11 +236,6 @@ static int mm_is_set_score_function(const struct osl_row *row, void *bitnum) return -100; } -static int para_random(unsigned max) -{ - return ((max + 0.0) * (rand() / (RAND_MAX + 1.0))); -} - /* returns 1 if row matches score item, -1 otherwise */ static int add_item_score(const void *row, struct mood_item *item, long *score, long *score_arg_sum) @@ -277,10 +273,8 @@ static int compute_mood_score(const void *row, long *result) /* reject if there is no matching entry in the accept list */ if (!match && !list_empty(¤t_mood->accept_list)) return -E_NOT_ADMISSIBLE; - list_for_each_entry(item, ¤t_mood->score_list, mood_item_node) { - PARA_INFO_LOG("random: %d\n", para_random(100)); + list_for_each_entry(item, ¤t_mood->score_list, mood_item_node) add_item_score(row, item, &score, &score_arg_sum); - } if (score_arg_sum) score /= score_arg_sum; *result = score;