Changed from random_rand() to rand() for better pseudo randomness

This commit is contained in:
adamdunkels 2009-02-07 18:43:45 +00:00
parent 3fcd77f522
commit 4b71003c2f

View file

@ -33,7 +33,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: neighbor-discovery.c,v 1.11 2008/11/17 22:52:10 oliverschmidt Exp $ * $Id: neighbor-discovery.c,v 1.12 2009/02/07 18:43:45 adamdunkels Exp $
*/ */
/** /**
@ -51,7 +51,7 @@
#include "dev/radio-sensor.h" #include "dev/radio-sensor.h"
#include "lib/random.h" #include "lib/rand.h"
#if CONTIKI_TARGET_NETSIM #if CONTIKI_TARGET_NETSIM
#include "ether.h" #include "ether.h"
@ -129,7 +129,7 @@ send_timer(void *ptr)
struct neighbor_discovery_conn *tc = ptr; struct neighbor_discovery_conn *tc = ptr;
ctimer_set(&tc->send_timer, ctimer_set(&tc->send_timer,
tc->max_interval / 2 + random_rand() % (tc->max_interval / 2), tc->max_interval / 2 + rand() % (tc->max_interval / 2),
send_adv, tc); send_adv, tc);
ctimer_set(&tc->interval_timer, ctimer_set(&tc->interval_timer,
tc->max_interval, tc->max_interval,
@ -179,7 +179,7 @@ neighbor_discovery_start(struct neighbor_discovery_conn *c, uint16_t val)
} }
c->val = val; c->val = val;
ctimer_set(&c->interval_timer, interval, send_timer, c); ctimer_set(&c->interval_timer, interval, send_timer, c);
ctimer_set(&c->send_timer, interval / 2 + random_rand() % (interval / 2), ctimer_set(&c->send_timer, interval / 2 + rand() % (interval / 2),
send_adv, c); send_adv, c);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/