瀏覽代碼

Enhanced seeding in examples

Paul-Louis Ageneau 2 年之前
父節點
當前提交
9f648bcd40
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 2 2
      examples/client-benchmark/main.cpp
  2. 2 2
      examples/client/main.cpp

+ 2 - 2
examples/client-benchmark/main.cpp

@@ -479,9 +479,9 @@ shared_ptr<rtc::PeerConnection> createPeerConnection(const rtc::Configuration &c
 
 // Helper function to generate a random ID
 std::string randomId(size_t length) {
-	using std::chrono::system_clock;
+	using std::chrono::high_resolution_clock;
 	static thread_local std::mt19937 rng(
-	    static_cast<unsigned int>(system_clock::now().time_since_epoch().count()));
+	    static_cast<unsigned int>(high_resolution_clock::now().time_since_epoch().count()));
 	static const std::string characters(
 	    "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
 	std::string id(length, '0');

+ 2 - 2
examples/client/main.cpp

@@ -264,9 +264,9 @@ shared_ptr<rtc::PeerConnection> createPeerConnection(const rtc::Configuration &c
 
 // Helper function to generate a random ID
 std::string randomId(size_t length) {
-	using std::chrono::system_clock;
+	using std::chrono::high_resolution_clock;
 	static thread_local std::mt19937 rng(
-	    static_cast<unsigned int>(system_clock::now().time_since_epoch().count()));
+	    static_cast<unsigned int>(high_resolution_clock::now().time_since_epoch().count()));
 	static const std::string characters(
 	    "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
 	std::string id(length, '0');