Removed AlgebraicNotation from the variant API.
[tagua/yd.git] / src / random.cpp
blob739923743562d83c921063753dc82a531ceea445
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #include "random.h"
13 Random* Random::m_instance = 0;
15 Random::Random() { }
17 Random::IntegerGenerator Random::rand(int min, int max) {
18 return IntegerGenerator(&m_generator, IntegerDistribution(min, max));
21 Random::RealGenerator Random::rand(float min, float max) {
22 return RealGenerator(&m_generator, RealDistribution(min, max));
25 Random::RealGenerator Random::rand(double min, double max) {
26 return rand(static_cast<float>(min),
27 static_cast<float>(max));
30 Random& Random::instance() {
31 if (!m_instance) {
32 m_instance = new Random;
34 return *m_instance;