mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
unimportant changes
This commit is contained in:
parent
4054afc759
commit
7f659573bc
21 changed files with 89 additions and 51 deletions
17
servatrice/src/rng_qt.cpp
Normal file
17
servatrice/src/rng_qt.cpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "rng_qt.h"
|
||||
#include <QDateTime>
|
||||
#include <stdlib.h>
|
||||
|
||||
RNG_Qt::RNG_Qt(QObject *parent)
|
||||
: AbstractRNG(parent)
|
||||
{
|
||||
int seed = QDateTime::currentDateTime().toTime_t();
|
||||
qDebug(QString("qsrand(%1)").arg(seed).toLatin1());
|
||||
qsrand(seed);
|
||||
}
|
||||
|
||||
unsigned int RNG_Qt::getNumber(unsigned int min, unsigned int max)
|
||||
{
|
||||
int r = qrand();
|
||||
return min + (unsigned int) (((double) (max + 1 - min)) * r / (RAND_MAX + 1.0));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue