Skip to content

Commit

Permalink
carrierroute: update to use kam_rand()
Browse files Browse the repository at this point in the history
  • Loading branch information
sjthomason committed Jul 7, 2016
1 parent 5836b40 commit c7d133b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion modules/carrierroute/cr_func.c
Expand Up @@ -40,6 +40,7 @@
#include "../../mem/mem.h"
#include "../../qvalue.h"
#include "../../dset.h"
#include "../../rand/kam_rand.h"
#include "cr_map.h"
#include "cr_rule.h"
#include "cr_domain.h"
Expand Down Expand Up @@ -510,7 +511,7 @@ static int rewrite_on_rule(struct route_flags *rf_head, flag_t flags, str * dest
* was previously tried */

do {
int rule_no = rand() % rf->rule_num;
int rule_no = kam_rand() % rf->rule_num;
//LM_DBG("CR: trying rule_no=%d \n", rule_no);
for (rr = rf->rule_list; (rule_no > 0) && (rr->next!=NULL) ; rule_no-- , rr = rr->next) {}
} while (cr_uri_already_used(rr->host, used_dests, no_dests));
Expand Down
4 changes: 2 additions & 2 deletions modules/carrierroute/prime_hash.c
Expand Up @@ -30,10 +30,10 @@
#include "../../parser/parse_to.h"
#include "../../parser/parse_from.h"
#include "../../crc.h"
#include "../../rand/kam_rand.h"

#include <ctype.h>
#include <stdio.h> /* for snprintf */
#include <stdlib.h> /* for rand */

#include "prime_hash.h"

Expand Down Expand Up @@ -153,7 +153,7 @@ static int determine_fromto_user (struct to_body *fromto, str *source_string) {

static int determine_fromrand(str* source_string){

snprintf(&cr_randbuf[0], CR_RANDBUF_S , "%d", rand());
snprintf(&cr_randbuf[0], CR_RANDBUF_S , "%d", kam_rand());

LM_NOTICE("randbuf is %s\n", cr_randbuf);
source_string->s = cr_randbuf;
Expand Down

0 comments on commit c7d133b

Please sign in to comment.