Changed from random_rand() to rand() function for (pseudo) random numbers because random_rand() does not work that well

This commit is contained in:
adamdunkels 2009-02-07 16:16:31 +00:00
parent 91e8487032
commit 752291f450
3 changed files with 9 additions and 9 deletions

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: ipolite.c,v 1.10 2008/07/07 23:27:05 adamdunkels Exp $
* $Id: ipolite.c,v 1.11 2009/02/07 16:16:31 adamdunkels Exp $
*/
/**
@ -45,7 +45,7 @@
#include "net/rime.h"
#include "net/rime/ipolite.h"
#include "lib/random.h"
#include "lib/rand.h"
#include <string.h>
@ -153,7 +153,7 @@ ipolite_send(struct ipolite_conn *c, clock_time_t interval, uint8_t hdrsize)
c->q = queuebuf_new_from_rimebuf();
if(c->q != NULL) {
ctimer_set(&c->t,
interval / 2 + (random_rand() % (interval / 2)),
interval / 2 + (rand() % (interval / 2)),
send, c);
return 1;
}

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: polite.c,v 1.5 2008/07/07 23:27:05 adamdunkels Exp $
* $Id: polite.c,v 1.6 2009/02/07 16:16:31 adamdunkels Exp $
*/
/**
@ -45,7 +45,7 @@
#include "net/rime.h"
#include "net/rime/polite.h"
#include "lib/random.h"
#include "lib/rand.h"
#include <string.h>
@ -128,7 +128,7 @@ polite_send(struct polite_conn *c, clock_time_t interval, uint8_t hdrsize)
c->hdrsize = hdrsize;
c->q = queuebuf_new_from_rimebuf();
if(c->q != NULL) {
ctimer_set(&c->t, interval / 2 + (random_rand() % (interval / 2)), send, c);
ctimer_set(&c->t, interval / 2 + (rand() % (interval / 2)), send, c);
return 1;
}
return 0;

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: trickle.c,v 1.13 2008/11/17 22:52:10 oliverschmidt Exp $
* $Id: trickle.c,v 1.14 2009/02/07 16:16:31 adamdunkels Exp $
*/
/**
@ -44,7 +44,7 @@
*/
#include "net/rime/trickle.h"
#include "lib/random.h"
#include "lib/rand.h"
#if CONTIKI_TARGET_NETSIM
#include "ether.h"
@ -116,7 +116,7 @@ run_trickle(struct trickle_conn *c)
while(1) {
interval = c->interval << c->interval_scaling;
set_timer(c, &c->interval_timer, interval);
set_timer(c, &c->t, interval / 2 + (random_rand() % (interval / 2)));
set_timer(c, &c->t, interval / 2 + (rand() % (interval / 2)));
c->duplicates = 0;
PT_YIELD(&c->pt); /* Wait until listen timeout */