fixed random seed for cooja motes

This commit is contained in:
fros4943 2010-05-02 09:42:15 +00:00
parent aa980e3f67
commit 79aa299531
2 changed files with 5 additions and 5 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: contiki-cooja-main.c,v 1.7 2010/03/31 09:39:46 fros4943 Exp $
* $Id: contiki-cooja-main.c,v 1.8 2010/05/02 09:42:15 fros4943 Exp $
*/
/**
@ -184,8 +184,7 @@ process_run_thread_loop(void *data)
simProcessRunValue = 1;
cooja_mt_yield();
/* Initialize random generator */
random_init(0);
/* Initialize random generator (moved to moteid.c) */
/* Start process handler */
process_init();

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: moteid.c,v 1.2 2008/10/28 15:37:34 fros4943 Exp $
* $Id: moteid.c,v 1.3 2010/05/02 09:42:15 fros4943 Exp $
*/
#include "dev/moteid.h"
@ -38,6 +38,7 @@ const struct simInterface moteid_interface;
// COOJA variables
int simMoteID;
char simMoteIDChanged;
int simRandomSeed;
/*-----------------------------------------------------------------------------------*/
static void
@ -45,7 +46,7 @@ doInterfaceActionsBeforeTick(void)
{
if (simMoteIDChanged) {
simMoteIDChanged = 0;
random_init((simMoteID+1));
random_init(simRandomSeed);
}
}
/*-----------------------------------------------------------------------------------*/