1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     math_Rand.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 47802 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_MATH_RAND_H_
17 #define NN_MATH_RAND_H_
18 
19 #include <nn/math/math_Config.h>
20 
21 namespace nn {
22 namespace math {
23 /* Please see man pages for details
24 
25 
26 
27 
28 
29 
30 */
31 class RandomGenerator
32 {
33 public:
34 /* Please see man pages for details
35 
36 
37 
38  */
RandomGenerator()39     RandomGenerator(){}
40 /* Please see man pages for details
41 
42 
43 
44  */
RandomGenerator(u64 seed)45     RandomGenerator(u64 seed){this->SetSeed(seed);}
46 /* Please see man pages for details
47 
48  */
~RandomGenerator()49     ~RandomGenerator(){}
50 
51 /* Please see man pages for details
52 
53 
54 
55  */
56     void SetSeed(u64 seed);
57 
58 /* Please see man pages for details
59 
60 
61 
62 
63  */
64     u32 Generate(u32 max=0);
65 private:
66     u64     m_x;    // Random number value
67     u64     m_mul;  // Multiplier
68     u64     m_add;  // The number to add
69 };
70 
71 // This is a private class for maintaining compatibility with CTR-SDK 3.3
72 // Do not use it, because it may be removed in the future.
73 class RamdomGenerator
74 {
75 public:
RamdomGenerator()76     RamdomGenerator(){}
RamdomGenerator(u64 seed)77     RamdomGenerator(u64 seed){this->SetSeed(seed);}
78 
~RamdomGenerator()79     ~RamdomGenerator(){}
80 
81     void SetSeed(u64 seed);
82     u32 Generate(u32 max=0);
83 private:
84     u64     m_x;    // Random number value
85     u64     m_mul;  // Multiplier
86     u64     m_add;  // The number to add
87 };
88 
89 }}
90 
91 #endif //NN_MATH_RAND_H
92