OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rng.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_MISC_RNG_H
2 #define OPENMW_COMPONENTS_MISC_RNG_H
3 
4 #include <cassert>
5 
6 namespace Misc
7 {
8 
9 /*
10  Provides central implementation of the RNG logic
11 */
12 class Rng
13 {
14 public:
15 
17  static void init();
18 
20  static float rollProbability();
21 
23  static float rollClosedProbability();
24 
26  static int rollDice(int max);
27 
29  static int roll0to99() { return rollDice(100); }
30 };
31 
32 }
33 
34 #endif
static void init()
seed the RNG
Definition: rng.cpp:8
static float rollClosedProbability()
return value in range [0.0f, 1.0f] <- note closed upper range.
Definition: rng.cpp:18
static int rollDice(int max)
return value in range [0, max) <- note open upper range.
Definition: rng.cpp:23
static int roll0to99()
return value in range [0, 99]
Definition: rng.hpp:29
static float rollProbability()
return value in range [0.0f, 1.0f) <- note open upper range.
Definition: rng.cpp:13
Definition: rng.hpp:12