SuperTuxKart
Loading...
Searching...
No Matches
random_generator.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2008-2015 Joerg Henrichs
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_RANDOM_GENERATOR_HPP
20#define HEADER_RANDOM_GENERATOR_HPP
21
22#include <algorithm>
23#include <vector>
24#include <stdlib.h>
25
34{
35private:
36 unsigned int m_random_value;
37 unsigned int m_a, m_c;
38 static std::vector<RandomGenerator*> m_all_random_generators;
39
40public:
42
43 //std::vector<int> generateAllSeeds();
45 int get(int n) {return rand() % n; }
46 void seed(int s) {m_random_value = s;}
47}; // RandomGenerator
48
49#endif // HEADER_RANDOM_GENERATOR_HPP
A random number generator.
Definition: random_generator.hpp:34
int get(int n)
Returns a pseudo random number between 0 and n-1 inclusive.
Definition: random_generator.hpp:45