forked from facebookarchive/RakNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandSync.h
58 lines (46 loc) · 1.42 KB
/
RandSync.h
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
50
51
52
53
54
55
56
57
58
/*
* Copyright (c) 2014, Oculus VR, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
/// \file
/// \brief \b [Internal] Random number generator
///
#ifndef __RAND_SYNC_H
#define __RAND_SYNC_H
#include "Export.h"
#include "Rand.h"
#include "DS_Queue.h"
#include "NativeTypes.h"
namespace RakNet {
class BitStream;
class RAK_DLL_EXPORT RakNetRandomSync
{
public:
RakNetRandomSync();
virtual ~RakNetRandomSync();
void SeedMT( uint32_t _seed );
void SeedMT( uint32_t _seed, uint32_t skipValues );
float FrandomMT( void );
unsigned int RandomMT( void );
uint32_t GetSeed( void ) const;
uint32_t GetCallCount( void ) const;
void SetCallCount( uint32_t i );
virtual void SerializeConstruction(RakNet::BitStream *constructionBitstream);
virtual bool DeserializeConstruction(RakNet::BitStream *constructionBitstream);
virtual void Serialize(RakNet::BitStream *outputBitstream);
virtual void Deserialize(RakNet::BitStream *outputBitstream);
protected:
void Skip( uint32_t count );
DataStructures::Queue<unsigned int> usedValues;
uint32_t seed;
uint32_t callCount;
uint32_t usedValueBufferCount;
RakNetRandom rnr;
};
} // namespace RakNet
#endif