mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-11 18:28:55 -04:00
Move pseudo RNG seeding to start of application
Also switched to qrand() in place of rand() where possible as it is thread safe. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5716 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QApplication>
|
||||
#include <QRegularExpression>
|
||||
#include <QObject>
|
||||
@@ -28,6 +29,18 @@
|
||||
#include "TraceFile.hpp"
|
||||
#include "mainwindow.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct RNGSetup
|
||||
{
|
||||
RNGSetup ()
|
||||
{
|
||||
// one time seed of pseudo RNGs from current time
|
||||
auto seed = QDateTime::currentMSecsSinceEpoch ();
|
||||
qsrand (seed); // this is good for rand() as well
|
||||
}
|
||||
} seeding;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user