SLikeNet  0.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rand.h
Go to the documentation of this file.
1 /*
2  * Original work: Copyright (c) 2014, Oculus VR, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7  * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8  *
9  *
10  * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11  *
12  * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13  * license found in the license.txt file in the root directory of this source tree.
14  */
15 
19 
20 
21 
22 #ifndef __RAND_H
23 #define __RAND_H
24 
25 #include "Export.h"
26 
30 extern void RAK_DLL_EXPORT seedMT( unsigned int seed );
31 
34 extern unsigned int RAK_DLL_EXPORT reloadMT( void );
35 
39 extern unsigned int RAK_DLL_EXPORT randomMT( void );
40 
44 extern float RAK_DLL_EXPORT frandomMT( void );
45 
48 extern void RAK_DLL_EXPORT fillBufferMT( void *buffer, unsigned int bytes );
49 
50 namespace SLNet {
51 
52 // Same thing as above functions, but not global
54 {
55 public:
56  RakNetRandom();
57  ~RakNetRandom();
58  void SeedMT( unsigned int seed );
59  unsigned int ReloadMT( void );
60  unsigned int RandomMT( void );
61  float FrandomMT( void );
62  void FillBufferMT( void *buffer, unsigned int bytes );
63 
64 protected:
65  unsigned int state[ 624 + 1 ];
66  unsigned int *next;
67  int left;
68 };
69 
70 } // namespace SLNet
71 
72 #endif