From 69e9066c7624080ea07f05323eab99c0c89692b4 Mon Sep 17 00:00:00 2001 From: Joseph Giovatto Date: Wed, 12 Jun 2019 12:39:59 -0400 Subject: [PATCH] use time in usec for rand seed removed extra call to srand in sesue process --- srsue/src/stack/rrc/rrc.cc | 9 +++++++-- srsue/src/stack/upper/nas.cc | 3 --- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index f354e0500..c4c690dd7 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -170,8 +170,13 @@ void rrc::init(phy_interface_rrc_lte* phy_, set_mac_default(); measurements.init(this); - // set seed for rand (used in attach) - srand(time(NULL)); + + struct timeval tv; + gettimeofday(&tv, NULL); + rrc_log->info("using srand seed of %ld\n", tv.tv_usec); + + // set seed (used in CHAP auth and attach) + srand(tv.tv_usec); running = true; start(); diff --git a/srsue/src/stack/upper/nas.cc b/srsue/src/stack/upper/nas.cc index 0c4ce62bf..f92d4e110 100644 --- a/srsue/src/stack/upper/nas.cc +++ b/srsue/src/stack/upper/nas.cc @@ -119,9 +119,6 @@ void nas::init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_ have_ctxt = true; } - // set seed for rand (used in CHAP auth) - srand(time(NULL)); - running = true; }