The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
random_new_synced.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
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  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #ifndef RANDOM_NEW_SYNCED_H_INCLUDED
16 #define RANDOM_NEW_SYNCED_H_INCLUDED
17 
18 #include "random_new.hpp"
19 #include "mt_rng.hpp"
20 
21 #include "utils/functional.hpp"
22 
23 /*
24 todo: use a boost::random based solution.
25 */
26 namespace random_new
27 {
28  class synced_rng : public random_new::rng
29  {
30  public:
31  synced_rng(std::function<std::string()> seed_generator);
32  virtual ~synced_rng();
33 
34  protected:
35  virtual uint32_t next_random_impl();
36  private:
37  void initialize();
39  std::function<std::string()> seed_generator_;
41  };
42 }
43 #endif
virtual uint32_t next_random_impl()
boost::uint32_t uint32_t
Definition: xbrz.hpp:45
synced_rng(std::function< std::string()> seed_generator)
this class does not give synced random results derived classes might do.
Definition: random_new.hpp:27
std::function< std::string()> seed_generator_
GLsizei const GLcharARB ** string
Definition: glew.h:4503