forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandomizer.h
More file actions
49 lines (40 loc) · 1.32 KB
/
randomizer.h
File metadata and controls
49 lines (40 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Filename: randomizer.h
// Created by: drose (18Jan07)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef RANDOMIZER_H
#define RANDOMIZER_H
#include "pandabase.h"
#include "mersenne.h"
#include <time.h>
#include <math.h>
////////////////////////////////////////////////////////////////////
// Class : Randomizer
// Description : A handy class to return random numbers.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_MATHUTIL Randomizer {
PUBLISHED:
INLINE Randomizer(unsigned long seed = 0);
INLINE Randomizer(const Randomizer ©);
INLINE void operator = (const Randomizer ©);
INLINE int random_int(int range);
INLINE double random_real(double range);
INLINE double random_real_unit();
INLINE static unsigned long get_next_seed();
INLINE unsigned long get_seed();
private:
Mersenne _mersenne;
static Mersenne _next_seed;
static bool _got_first_seed;
};
#include "randomizer.I"
#endif