mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
Updated SFMT RNG code, removed Qt RNG
This commit is contained in:
parent
ed5f02bf7a
commit
a15eb6f29f
11 changed files with 653 additions and 557 deletions
|
|
@ -1,13 +1,27 @@
|
|||
#ifndef RNG_SFMT_H
|
||||
#define RNG_SFMT_H
|
||||
|
||||
#include "sfmt/SFMT.h"
|
||||
#include "rng_abstract.h"
|
||||
#include <QMutex>
|
||||
|
||||
/**
|
||||
* This class represents the random number generator.
|
||||
* It uses the SIMD-oriented Fast Mersenne Twister code v1.4.1 from
|
||||
* http://www.math.sci.hiroshima-u.ac.jp/~%20m-mat/MT/SFMT/index.html
|
||||
* To use this RNG, the class needs a sfmt_t structure for the RNG's internal state.
|
||||
* It has to be initialized by sfmt_init_gen_rand() which is done in the constructor.
|
||||
* The function sfmt_genrand_uint64() can then be used to create a 64 bit unsigned int
|
||||
* pseudorandom number. This is done in getNumber().
|
||||
* For more information see the author's website and look at the documentation and
|
||||
* examples that are part of the official downloads.
|
||||
*/
|
||||
|
||||
class RNG_SFMT : public RNG_Abstract {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QMutex mutex;
|
||||
sfmt_t sfmt;
|
||||
public:
|
||||
RNG_SFMT(QObject *parent = 0);
|
||||
unsigned int getNumber(unsigned int min, unsigned int max);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue