Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package logfilegen for openSUSE:Factory 
checked in at 2023-03-02 23:04:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/logfilegen (Old)
 and      /work/SRC/openSUSE:Factory/.logfilegen.new.31432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "logfilegen"

Thu Mar  2 23:04:46 2023 rev:8 rq:1069028 version:2.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/logfilegen/logfilegen.changes    2023-02-27 
12:55:49.419590854 +0100
+++ /work/SRC/openSUSE:Factory/.logfilegen.new.31432/logfilegen.changes 
2023-03-02 23:05:05.212328515 +0100
@@ -1,0 +2,6 @@
+Thu Mar  2 19:20:36 UTC 2023 - Andreas Stieger <andreas.stie...@gmx.de>
+
+- logfilegen 2.3.0:
+  * randomization engine take less resources
+
+-------------------------------------------------------------------

Old:
----
  logfilegen-2.2.0.tar.gz

New:
----
  logfilegen-2.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ logfilegen.spec ++++++
--- /var/tmp/diff_new_pack.Pgltyj/_old  2023-03-02 23:05:05.856331732 +0100
+++ /var/tmp/diff_new_pack.Pgltyj/_new  2023-03-02 23:05:05.860331752 +0100
@@ -18,7 +18,7 @@
 
 
 Name:           logfilegen
-Version:        2.2.0
+Version:        2.3.0
 Release:        0
 Summary:        Log file generator for server log files and user-defined 
formats
 License:        Unlicense

++++++ logfilegen-2.2.0.tar.gz -> logfilegen-2.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/.github/workflows/MacARMBuild.yml 
new/logfilegen-2.3.0/.github/workflows/MacARMBuild.yml
--- old/logfilegen-2.2.0/.github/workflows/MacARMBuild.yml      1970-01-01 
01:00:00.000000000 +0100
+++ new/logfilegen-2.3.0/.github/workflows/MacARMBuild.yml      2023-03-02 
18:22:06.000000000 +0100
@@ -0,0 +1,20 @@
+name: MacARMBuild
+
+
+on: workflow_dispatch
+
+
+jobs:
+
+  macos:
+    runs-on: macos-latest
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v3
+    - name: Build
+      run: make --makefile=Makefile.clang.macarm
+    - name: Archive production artifacts
+      uses: actions/upload-artifact@v3
+      with:
+       name: logfilegen-macos-arm64-binary
+       path: logfilegen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/CMakeLists.txt 
new/logfilegen-2.3.0/CMakeLists.txt
--- old/logfilegen-2.2.0/CMakeLists.txt 2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/CMakeLists.txt 2023-03-02 18:22:06.000000000 +0100
@@ -5,8 +5,6 @@
 option(USE_PROMCPP "Use prometheus_cpp" OFF)
 option(USE_STATIC "Static build" OFF)
 option(USE_CLANG "Build with Clang" OFF)
-#option(USE_OPENSUSE "Build with OpenSUSE" OFF)
-
 
 
 if(USE_CLANG)
@@ -16,12 +14,10 @@
 endif(USE_CLANG)
 
 
-
-project (logfilegen VERSION 2.2.0 LANGUAGES CXX)
+project (logfilegen VERSION 2.3.0 LANGUAGES CXX)
 
add_definitions(-DVERSION_NUMBER="\\"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}\\"")
 
 
-
 set(SOURCES
     utl.cpp
     params.cpp
@@ -39,8 +35,7 @@
 
 #set(CMAKE_EXE_LINKER_FLAGS "-pthread -lpthread")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
-
-
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -O3 ")
 
 
 #if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION 
VERSION_LESS 9.1.0)
@@ -48,7 +43,6 @@
 #endif()
 
 
-
 if(USE_STATIC)
   message("+ static build")
 
@@ -66,10 +60,11 @@
 endif()
 
 
-set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig")
 
 if(USE_PROMCPP)
 
+set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig")
+
 find_package(PkgConfig REQUIRED)
 
 pkg_check_modules(prometheus-cpp-core QUIET prometheus-cpp-core)
@@ -92,7 +87,6 @@
 
  target_link_libraries(logfilegen ${prometheus-cpp-pull_LIBRARIES})
 
-
 endif()
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/ChangeLog 
new/logfilegen-2.3.0/ChangeLog
--- old/logfilegen-2.2.0/ChangeLog      2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/ChangeLog      2023-03-02 18:22:06.000000000 +0100
@@ -1,3 +1,7 @@
++ CMake support optimization
++ HaikuOS support (compile with make --makefile=Makefile.Haiku
++ Mac ARM support (compile with make --makefile=Makefile.macarm
+
 + Min C++ ver is 11 instead of 17
 
 + outdated GCC (< 9.1.0) support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/Makefile.Haiku 
new/logfilegen-2.3.0/Makefile.Haiku
--- old/logfilegen-2.2.0/Makefile.Haiku 1970-01-01 01:00:00.000000000 +0100
+++ new/logfilegen-2.3.0/Makefile.Haiku 2023-03-02 18:22:06.000000000 +0100
@@ -0,0 +1,25 @@
+ifndef prefix
+prefix=/usr
+endif
+
+CXX = g++
+CXXFLAGS = -Wall -g -Og -std=c++11 -pthread -lpthread
+
+
+all: main.cpp
+       $(CXX) $(CXXFLAGS) -o logfilegen utl.cpp params.cpp macro.cpp vars.cpp 
tpl.cpp pairfile.cpp cycle.cpp logrot.cpp main.cpp  -lnetwork
+
+
+clean:
+       $(RM) logfilegen
+
+uninstall:
+       rm $(DESTDIR)$(prefix)/bin/logfilegen
+
+install: logfilegen
+       install -m 0755 logfilegen $(DESTDIR)$(prefix)/bin/logfilegen
+
+test:
+       logfilegen --help
+
+#.PHONY: install
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/Makefile.clang.macarm 
new/logfilegen-2.3.0/Makefile.clang.macarm
--- old/logfilegen-2.2.0/Makefile.clang.macarm  1970-01-01 01:00:00.000000000 
+0100
+++ new/logfilegen-2.3.0/Makefile.clang.macarm  2023-03-02 18:22:06.000000000 
+0100
@@ -0,0 +1,21 @@
+ifndef prefix
+prefix=/usr
+endif
+
+CXX = clang++
+CXXFLAGS = -Wall -g -O3 -std=c++11 -target arm64-apple-macos11 
-mmacosx-version-min=11.0
+
+all: main.cpp
+       $(CXX) $(CXXFLAGS) -o logfilegen utl.cpp params.cpp vars.cpp macro.cpp 
tpl.cpp pairfile.cpp logrot.cpp cycle.cpp main.cpp
+
+clean:
+       $(RM) logfilegen
+
+
+uninstall:
+       rm $(DESTDIR)$(prefix)/bin/logfilegen
+
+install: logfilegen
+       install -m 0755 logfilegen $(DESTDIR)$(prefix)/bin
+
+.PHONY: install
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/NEWS new/logfilegen-2.3.0/NEWS
--- old/logfilegen-2.2.0/NEWS   2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/NEWS   2023-03-02 18:22:06.000000000 +0100
@@ -1 +1,4 @@
-This release makes logfilegen possible to build on old compiler versions. Now 
logfilegen needs C++11 instead of C++17.
++ CMake support optimization
++ HaikuOS support (compile with make --makefile=Makefile.Haiku
++ Mac ARM support (compile with make --makefile=Makefile.macarm
+* randomization engine take less resources
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/README.md 
new/logfilegen-2.3.0/README.md
--- old/logfilegen-2.2.0/README.md      2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/README.md      2023-03-02 18:22:06.000000000 +0100
@@ -17,7 +17,7 @@
 
 ## ABOUT
 
-Logfilegen is a fast and highly customizable tool to generate server (nginx, 
etc) or user-defined format log files. You can generate log file with the 
desired rate (lines per second), the file size, lines count and the duration. 
Each variable of the log file can be redefined by the random or static value. 
logfilegen depends just on GCC or Clang with C++17 support, and, optionally, 
cmake.
+Logfilegen is a fast and highly customizable tool to generate server (nginx, 
etc) or user-defined format log files. You can generate log file with the 
desired rate (lines per second), the file size, lines count and the duration. 
Each variable of the log file can be redefined by the random or static value. 
logfilegen depends just on GCC or Clang with C++11 support, and, optionally, 
cmake.
 
 ## USE
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/cycle.cpp 
new/logfilegen-2.3.0/cycle.cpp
--- old/logfilegen-2.2.0/cycle.cpp      2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/cycle.cpp      2023-03-02 18:22:06.000000000 +0100
@@ -23,6 +23,7 @@
 
 using namespace std::chrono;
 
+
 namespace
 {
   volatile std::sig_atomic_t g_signal;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/cycle.h new/logfilegen-2.3.0/cycle.h
--- old/logfilegen-2.2.0/cycle.h        2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/cycle.h        2023-03-02 18:22:06.000000000 +0100
@@ -4,30 +4,34 @@
 #include <fstream>
 
 #ifndef PROM
-
 #include <future>
-
 #endif
 
 
 #ifndef PROM
 
 #if defined(_WIN32) || defined(_WIN64)
-
-#include <winsock2.h>
 //#include <WinSock2.h>
 //#include <WinSock.h>
-#else
+#include <winsock2.h>
+#endif
 
+#ifdef __HAIKU__
+//
+#include <Socket.h>
+#endif
+
+
+#ifdef __unix__
 #include <netinet/in.h>
 #include <sys/socket.h>
 //#include <arpa/inet.h>
-
 #endif
 
 #endif
 
 
+
 #ifdef PROM
 
 #include "prometheus/client_metric.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/docs/index.md 
new/logfilegen-2.3.0/docs/index.md
--- old/logfilegen-2.2.0/docs/index.md  2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/docs/index.md  2023-03-02 18:22:06.000000000 +0100
@@ -1,6 +1,6 @@
 # logfilegen
 
-Logfilegen is a fast and highly customizable tool to generate common server 
(nginx, etc) or user-defined format log files. You can generate log file with 
the desired rate (lines per second), the file size, lines count and the 
duration. Each variable of the log file can be redefined by the random or 
static value. logfilegen depends just on GCC or Clang with C++17 support, and, 
optionally, cmake.
+Logfilegen is a fast and highly customizable tool to generate common server 
(nginx, etc) or user-defined format log files. You can generate log file with 
the desired rate (lines per second), the file size, lines count and the 
duration. Each variable of the log file can be redefined by the random or 
static value. logfilegen depends just on GCC or Clang with C++11 support, and, 
optionally, cmake.
 
 ## LINKS
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/docs/inst.md 
new/logfilegen-2.3.0/docs/inst.md
--- old/logfilegen-2.2.0/docs/inst.md   2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/docs/inst.md   2023-03-02 18:22:06.000000000 +0100
@@ -2,7 +2,7 @@
 
 To compile logfilegen from the source you need GCC/g++ or Clang with C++17 
version support. If you did not compiled programs before, install GCC/g++ or 
Clang, **cmake** and **make** utility to your system.
 
-Use the tarball with the [latest 
release](https://github.com/psemiletov/logfilegen/releases/latest), it is 
always stable. Altough logfilegen has several manually written makefiles, the 
prefered way to compile logfilegen is CMake/make pair. For example, with CMake 
you can compile logfilegen with outdated GCC versions, or easily use Clang 
instead of GCC.
+Use the tarball with the [latest 
release](https://github.com/psemiletov/logfilegen/releases/latest), it is 
always stable. Altough logfilegen has several manually written makefiles, the 
prefered way to compile logfilegen is CMake/make pair.
 
 
 ### Build the source with CMake/Make
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/macro.cpp 
new/logfilegen-2.3.0/macro.cpp
--- old/logfilegen-2.2.0/macro.cpp      2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/macro.cpp      2023-03-02 18:22:06.000000000 +0100
@@ -25,17 +25,32 @@
 using namespace std;
 
 
+std::mt19937 &mt()
+{
+  // initialize once per thread
+  //thread_local static std::random_device srd;
+  //thread_local static std::mt19937 smt(srd());
+
+
+  unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
+  thread_local static std::mt19937 smt(seed);
+
+  return smt;
+}
+
+
+
 char arr_nums [] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 
'b', 'c', 'd', 'e', 'f'};
 
 
-int get_rnd (std::mt19937 *rnd_generator, int ta, int tb)
+int get_rnd (int ta, int tb)
 {
   std::uniform_int_distribution <> distrib (ta, tb);
-  return distrib (*rnd_generator);
+  return distrib (mt());
 }
 
 
-string gen_string (std::mt19937 *rnd_generator, size_t len)
+string gen_string (size_t len)
 {
   string result;
   result.reserve (128);
@@ -44,7 +59,7 @@
 
   for (size_t i = 0; i < len; i++)
       {
-       int g = distrib (*rnd_generator);
+       int g = distrib (mt());
        char d = static_cast<char> (g + 'a');
        result += d;
       }
@@ -53,18 +68,18 @@
 }
 
 
-string gen_string (std::mt19937 *rnd_generator, size_t min, size_t max)
+string gen_string (size_t min, size_t max)
 {
   string result;
   result.reserve (128);
 
   std::uniform_int_distribution<> distrib (0, 25);
   std::uniform_int_distribution<> dminmax (min, max);
-  size_t len = dminmax (*rnd_generator);
+  size_t len = dminmax (mt());
 
   for (size_t i = 0; i < len; i++)
       {
-       int g = distrib (*rnd_generator);
+       int g = distrib (mt());
        char d = static_cast<char> (g + 'a');
        result += d;
       }
@@ -72,26 +87,27 @@
   return result;
 }
 
-string gen_rnd_path (std::mt19937 *rnd_generator, size_t min, size_t max, 
size_t deep)
+
+string gen_rnd_path (size_t min, size_t max, size_t deep)
 {
   string result;
   result.reserve (256);
 
-  size_t deep_max = get_rnd (rnd_generator, 1, deep);
+  size_t deep_max = get_rnd (1, deep);
 
   for (size_t d = 0; d < deep_max; d++)
       {
        result += "/";
-       int len = get_rnd (rnd_generator, min, max);
+       int len = get_rnd (min, max);
 
-       result += gen_string (rnd_generator, len);
+       result += gen_string (len);
       }
 
   return result;
 }
 
 
-string gen_number (std::mt19937 *rnd_generator, size_t len)
+string gen_number (size_t len)
 {
   std::uniform_int_distribution<> distrib (0, 9);
 
@@ -100,32 +116,32 @@
 
   for (size_t i = 0; i < len; i++)
       {
-       result += arr_nums[distrib (*rnd_generator)];
+       result += arr_nums[distrib (mt())];
       }
 
   return result;
 }
 
 
-string gen_number (std::mt19937 *rnd_generator, size_t min, size_t max)
+string gen_number (size_t min, size_t max)
 {
   std::uniform_int_distribution<> distrib (0, 9);
   std::uniform_int_distribution<> dminmax (min, max);
-  size_t len = dminmax (*rnd_generator);
+  size_t len = dminmax (mt());
 
   string result;
   result.reserve (len);
 
   for (size_t i = 0; i < len; i++)
       {
-       result += arr_nums[distrib (*rnd_generator)];
+       result += arr_nums[distrib (mt())];
       }
 
   return result;
 }
 
 
-string gen_hex_number (std::mt19937 *rnd_generator, size_t len)
+string gen_hex_number (size_t len)
 {
   std::uniform_int_distribution<> distrib (0, 15);
 
@@ -134,25 +150,25 @@
 
   for (size_t i = 0; i < len; i++)
       {
-       result += arr_nums[distrib (*rnd_generator)];
+       result += arr_nums[distrib (mt())];
       }
 
   return result;
 }
 
 
-string gen_hex_number (std::mt19937 *rnd_generator, size_t min, size_t max)
+string gen_hex_number (size_t min, size_t max)
 {
   std::uniform_int_distribution<> distrib (0, 15);
   std::uniform_int_distribution<> dminmax (min, max);
-  size_t len = dminmax (*rnd_generator);
+  size_t len = dminmax (mt());
 
   string result;
   result.reserve (len);
 
   for (size_t i = 0; i < len; i++)
       {
-       result += arr_nums[distrib (*rnd_generator)];
+       result += arr_nums[distrib (mt())];
       }
 
   return result;
@@ -161,7 +177,7 @@
 
 CMacro::CMacro()
 {
-  rnd_generator = new std::mt19937 (rnd_dev());
+ // rnd_generator = new std::mt19937 (rnd_dev());
 
   len_min = 0;
   len_max = 0;
@@ -171,7 +187,7 @@
 
 CMacro::~CMacro()
 {
-  delete rnd_generator;
+  //delete rnd_generator;
 }
 
 
@@ -233,16 +249,16 @@
   string result;
   result.reserve (16);
 
-  result += to_string (distrib (*rnd_generator));
+  result += to_string (distrib (mt()));
   result += ".";
 
-  result += to_string (distrib (*rnd_generator));
+  result += to_string (distrib (mt()));
   result += ".";
 
-  result += to_string (distrib (*rnd_generator));
+  result += to_string (distrib (mt()));
   result += ".";
 
-  result += to_string (distrib (*rnd_generator));
+  result += to_string (distrib (mt()));
 
   return result;
 }
@@ -278,9 +294,9 @@
 string CMacroStrRandom::process()
 {
   if (len_max == 0)
-     return gen_string (rnd_generator, length);
+     return gen_string (length);
 
-  return gen_string (rnd_generator, len_min, len_max);
+  return gen_string (len_min, len_max);
 }
 
 
@@ -314,9 +330,9 @@
 string CMacroIntRandom::process()
 {
   if (len_max == 0)
-     return gen_number (rnd_generator, length);
+     return gen_number (length);
 
-  return gen_number (rnd_generator, len_min, len_max);
+  return gen_number (len_min, len_max);
 }
 
 
@@ -350,9 +366,9 @@
 string CMacroHexRandom::process()
 {
   if (len_max == 0)
-     return gen_hex_number (rnd_generator, length);
+     return gen_hex_number (length);
 
-  return gen_hex_number (rnd_generator, len_min, len_max);
+  return gen_hex_number (len_min, len_max);
 }
 
 
@@ -427,7 +443,7 @@
 
 string CMacroPathRandom::process()
 {
-   return gen_rnd_path (rnd_generator, len_min, len_max, length);
+   return gen_rnd_path (len_min, len_max, length);
 }
 
 
@@ -489,7 +505,7 @@
 
 string CMacroSeq::process()
 {
-   size_t i = get_rnd (rnd_generator, 1, vt.size() - 1);
+   size_t i = get_rnd (1, vt.size() - 1);
 
    return vt[i];
 }
@@ -522,7 +538,7 @@
 string CMacroFileSource::process()
 {
   if (vt.size() != 0)
-     text = vt[get_rnd (rnd_generator, 0, vt.size()-1)];
+     text = vt[get_rnd (0, vt.size()-1)];
 
   return text;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/macro.h new/logfilegen-2.3.0/macro.h
--- old/logfilegen-2.2.0/macro.h        2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/macro.h        2023-03-02 18:22:06.000000000 +0100
@@ -10,8 +10,8 @@
 class CMacro
 {
 public:
-   std::mt19937 *rnd_generator;
-   std::random_device rnd_dev;
+   //std::mt19937 *rnd_generator;
+//   std::random_device rnd_dev;
 
    std::string text;
    std::string meta; //состоит из @1 @2 ..
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/main.cpp 
new/logfilegen-2.3.0/main.cpp
--- old/logfilegen-2.2.0/main.cpp       2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/main.cpp       2023-03-02 18:22:06.000000000 +0100
@@ -34,7 +34,7 @@
 
 
 #ifndef VERSION_NUMBER
-#define VERSION_NUMBER "2.2.0"
+#define VERSION_NUMBER "2.3.0"
 #endif
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/vars.cpp 
new/logfilegen-2.3.0/vars.cpp
--- old/logfilegen-2.2.0/vars.cpp       2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/vars.cpp       2023-03-02 18:22:06.000000000 +0100
@@ -16,6 +16,21 @@
 using namespace std;
 
 
+std::mt19937 &vmt()
+{
+  // initialize once per thread
+  //thread_local static std::random_device srd;
+  //thread_local static std::mt19937 smt(srd());
+
+
+  unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
+  thread_local static std::mt19937 smt(seed);
+
+  return smt;
+}
+
+
+
 int get_value_nature (const string &s)
 {
   if (s.empty())
@@ -41,7 +56,10 @@
   rnd_length = 8;
   precision = 3;
 
-  rnd_generator = new std::mt19937 (rnd_dev());
+//  rnd_generator = new std::mt19937 (rnd_dev());
+
+  //rnd_generator = new std::mt19937 
(std::chrono::system_clock::now().time_since_epoch().count());
+
   vartype = get_value_nature (val);
 
   //если макрос и не SEQ
@@ -111,14 +129,14 @@
 
 CVar::~CVar()
 {
-  delete rnd_generator;
+  //delete rnd_generator;
 }
 
 
 int CVar::get_rnd (int ta, int tb)
 {
    std::uniform_int_distribution <> distrib (ta, tb);
-   return distrib (*rnd_generator);
+   return distrib (vmt());
 }
 
 
@@ -126,11 +144,11 @@
 {
   std::uniform_real_distribution <> distrib (fa, fb);
 
-  std::string s;
+//  std::string s;
   std::stringstream sstream;
-  sstream.setf(std::ios::fixed);
+  sstream.setf (std::ios::fixed);
   sstream.precision (precision);
-  sstream << distrib (*rnd_generator);
+  sstream << distrib (vmt());
 
   return sstream.str();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/logfilegen-2.2.0/vars.h new/logfilegen-2.3.0/vars.h
--- old/logfilegen-2.2.0/vars.h 2023-02-26 20:23:36.000000000 +0100
+++ new/logfilegen-2.3.0/vars.h 2023-03-02 18:22:06.000000000 +0100
@@ -28,8 +28,8 @@
 {
 public:
 
-  std::mt19937 *rnd_generator;
-  std::random_device rnd_dev;
+  //std::mt19937 *rnd_generator;
+  //std::random_device rnd_dev;
 
   CMacrosPool pool;
   CMacrosCache cache;

Reply via email to