+7
-3
lines changedFilter options
+7
-3
lines changed Original file line number Diff line number Diff line change
@@ -18,9 +18,11 @@
18
18
19
19
#include "srt.h"
20
20
21
+
#include <array>
21
22
#include <thread>
22
23
#include <fstream>
23
24
#include <ctime>
25
+
#include <random>
24
26
#include <vector>
25
27
26
28
//#pragma comment (lib, "ws2_32.lib")
@@ -35,7 +37,7 @@ TEST(Transmission, FileUpload)
35
37
36
38
SRTSOCKET sock_lsn = srt_create_socket(), sock_clr = srt_create_socket();
37
39
38
-
int tt = SRTT_FILE;
40
+
const int tt = SRTT_FILE;
39
41
srt_setsockflag(sock_lsn, SRTO_TRANSTYPE, &tt, sizeof tt);
40
42
srt_setsockflag(sock_clr, SRTO_TRANSTYPE, &tt, sizeof tt);
41
43
@@ -75,11 +77,13 @@ TEST(Transmission, FileUpload)
75
77
std::ofstream outfile("file.source", std::ios::out | std::ios::binary);
76
78
ASSERT_EQ(!!outfile, true) << srt_getlasterror_str();
77
79
78
-
srand(time(0));
80
+
std::random_device rd;
81
+
std::mt19937 mtrd(rd());
82
+
std::uniform_int_distribution<short> dis(0, UINT8_MAX);
79
83
80
84
for (size_t i = 0; i < filesize; ++i)
81
85
{
82
-
char outbyte = rand() % 255;
86
+
char outbyte = dis(mtrd);
83
87
outfile.write(&outbyte, 1);
84
88
}
85
89
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4