Skip to content

Commit

Permalink
switch to std::random
Browse files Browse the repository at this point in the history
  • Loading branch information
William C Bonner committed Dec 5, 2023
1 parent d4df973 commit 7727474
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (CMAKE_VERSION VERSION_GREATER 3.22)
endif()

project (GoveeBTTempLogger
VERSION 2.20231201.0
VERSION 2.20231201.1
DESCRIPTION "Listen and log Govee Thermometer Bluetooth Low Energy Advertisments"
HOMEPAGE_URL https://github.com/wcbonner/GoveeBTTempLogger
)
Expand Down
5 changes: 3 additions & 2 deletions goveebttemplogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
#include <netdb.h>
#include <netinet/in.h>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
Expand Down Expand Up @@ -259,9 +260,9 @@ int hci_le_set_ext_scan_enable(int dd, uint8_t enable, uint8_t filter_dup, int t
int hci_le_set_random_address(int dd, int to)
{
le_set_random_address_cp scan_cp{ 0 };
srand(time(NULL) + getpid());
std::default_random_engine generator(std::chrono::system_clock::now().time_since_epoch().count()); // 2023-12-01 switch to c++ std library <random>
for (auto & b : scan_cp.bdaddr.b)
b = rand() % 256;
b = generator() % 256;
uint8_t status;
struct hci_request rq;
memset(&rq, 0, sizeof(rq));
Expand Down

0 comments on commit 7727474

Please sign in to comment.