Skip to content

Commit

Permalink
Revert "Update drouting.c"
Browse files Browse the repository at this point in the history
This reverts commit bf4c8a9.
  • Loading branch information
bogdan-iancu committed Mar 16, 2023
1 parent bf4c8a9 commit a162879
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/drouting/drouting.c
Original file line number Diff line number Diff line change
Expand Up @@ -2724,7 +2724,7 @@ static int weight_based_sort(pgw_list_t *pgwl, int size, unsigned short *idx)
}
if (weight_sum) {
/* randomly select number */
rand_no = (unsigned int)(weight_sum*((double)rand()/((double)RAND_MAX+1)));
rand_no = (unsigned int)(weight_sum*((float)rand()/(float)RAND_MAX));
LM_DBG("random number is %d\n",rand_no);
/* select the element */
for( i=first ; i<size ; i++ )
Expand All @@ -2741,7 +2741,7 @@ static int weight_based_sort(pgw_list_t *pgwl, int size, unsigned short *idx)
}
} else {
/* randomly select index */
// i = (unsigned int)((size-first)*((double)rand()/((double)RAND_MAX+1)));
// i = (unsigned int)((size-first)*((float)rand()/RAND_MAX));
i = first;
}
LM_DBG("selecting element %d with weight %d\n",
Expand Down

0 comments on commit a162879

Please sign in to comment.