[hamradio-commits] [gnss-sdr] 72/303: Use current time as seed for random generator

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Mon Feb 13 22:35:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch master
in repository gnss-sdr.

commit cd0cec131b82c9ebae1c81aef5f0f044cbf9f321
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Sun Oct 2 12:57:01 2016 +0200

    Use current time as seed for random generator
---
 src/tests/system-tests/ttff_gps_l1.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc
index 17965c2..eacafd3 100644
--- a/src/tests/system-tests/ttff_gps_l1.cc
+++ b/src/tests/system-tests/ttff_gps_l1.cc
@@ -30,9 +30,9 @@
  * -------------------------------------------------------------------------
  */
 
-#include <ctime>
 #include <chrono>
 #include <cstdlib>
+#include <ctime>
 #include <numeric>
 #include <string>
 #include <sys/types.h>
@@ -42,11 +42,11 @@
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 #include <gtest/gtest.h>
-#include "in_memory_configuration.h"
-#include "file_configuration.h"
-#include "concurrent_queue.h"
 #include "concurrent_map.h"
+#include "concurrent_queue.h"
 #include "control_thread.h"
+#include "file_configuration.h"
+#include "in_memory_configuration.h"
 #include "gnss_flowgraph.h"
 #include "gps_acq_assist.h"
 
@@ -343,6 +343,7 @@ TEST_F(TTFF_GPS_L1_CA_Test, ColdStart)
             std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds." << std::endl;
             if(n < FLAGS_num_measurements - 1)
                 {
+                    std::srand(std::time(0)); // use current time as seed for random generator
                     int random_variable = std::rand();
                     float random_variable_0_1 = static_cast<float>(random_variable) / static_cast<float>( RAND_MAX );
                     int random_delay_s = static_cast<int>(random_variable_0_1 * 25.0);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list