mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-11 02:09:03 -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:
+3
-4
@@ -32,14 +32,13 @@ Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds,
|
||||
, m_phi {0.0}
|
||||
, m_toneSpacing {0.0}
|
||||
, m_fSpread {0.0}
|
||||
, m_itone0 {0}
|
||||
, m_frameRate {frameRate}
|
||||
, m_period {periodLengthInSeconds}
|
||||
, m_state {Idle}
|
||||
, m_tuning {false}
|
||||
, m_cwLevel {false}
|
||||
{
|
||||
qsrand (QDateTime::currentMSecsSinceEpoch()); // Initialize random seed
|
||||
m_itone0=0;
|
||||
}
|
||||
|
||||
void Modulator::start (unsigned symbolsLength, double framesPerSymbol,
|
||||
@@ -232,8 +231,8 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
|
||||
|
||||
int j=m_ic/480;
|
||||
if(m_fSpread>0.0 and j!=j0) {
|
||||
float x1=(float)rand()/RAND_MAX;
|
||||
float x2=(float)rand()/RAND_MAX;
|
||||
float x1=(float)qrand()/RAND_MAX;
|
||||
float x2=(float)qrand()/RAND_MAX;
|
||||
toneFrequency = toneFrequency0 + 0.5*m_fSpread*(x1+x2-1.0);
|
||||
m_dphi = m_twoPi * toneFrequency / m_frameRate;
|
||||
j0=j;
|
||||
|
||||
Reference in New Issue
Block a user