gwnavruntime/kernel/SF_Random.h Source File

SF_Random.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 /**************************************************************************
8 
9 PublicHeader: Kernel
10 Filename : KY_Random.h
11 Content : Pseudo-random number generator
12 Created : June 27, 2005
13 Authors :
14 
15 **************************************************************************/
16 
17 #ifndef INC_KY_Kernel__Random_H
18 #define INC_KY_Kernel__Random_H
19 
21 
22 namespace Kaim { namespace Alg {
23 
24 class Random
25 {
26 public:
27 
28  // Global generator.
29  static UInt32 KY_STDCALL NextRandom();
30  static void KY_STDCALL SeedRandom(UInt32 seed);
31  static float KY_STDCALL GetUnitFloat();
32 
33  // In case you need independent generators. The global
34  // generator is just an instance of this.
35  enum RandomConstants {
36  Random_SeedCount = 8
37  };
38 
39  class Generator
40  {
41  public:
42  UInt32 Q[Random_SeedCount];
43  UInt32 C;
44  UInt32 I;
45 
46  public:
47  Generator();
48  void SeedRandom(UInt32 seed); // not necessary
49  UInt32 NextRandom();
50  float GetUnitFloat();
51  };
52 
53 };
54 
55 }}
56 
57 #endif // INC_KY_Kernel__Random_H
Definition: gamekitcrowddispersion.h:20