unimportant changes

This commit is contained in:
Max-Wilhelm Bruker 2009-06-10 21:17:24 +02:00
parent 4054afc759
commit 7f659573bc
21 changed files with 89 additions and 51 deletions

17
servatrice/src/rng_qt.cpp Normal file
View 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));
}