ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
rewire_rng.c
Go to the documentation of this file.
1
20
21#include "rewire_rng.h"
22
24
25unsigned Random_Int(int fReset) {
26 static unsigned int m_z = NUMBER1;
27 static unsigned int m_w = NUMBER2;
28 if (fReset) {
29 m_z = NUMBER1;
30 m_w = NUMBER2;
31 }
32 m_z = 36969 * (m_z & 65535) + (m_z >> 16);
33 m_w = 18000 * (m_w & 65535) + (m_w >> 16);
34 return (m_z << 16) + m_w;
35}
36
37word Random_Word(int fReset) {
38 return ((word)Random_Int(fReset) << 32) | ((word)Random_Int(fReset) << 0);
39}
40
41// This procedure should be called once with Seed > 0 to initialize the generator.
42// After initialization, the generator should be always called with Seed == 0.
43unsigned Random_Num(int Seed) {
44 static unsigned RandMask = 0;
45 if (Seed == 0)
46 return RandMask ^ Random_Int(0);
47 RandMask = Random_Int(1);
48 for (int i = 0; i < Seed; i++)
49 RandMask = Random_Int(0);
50 return RandMask;
51}
52
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define NUMBER2
Definition aigUtil.c:1157
#define NUMBER1
Definition aigUtil.c:1156
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
unsigned Random_Num(int Seed)
Definition rewire_rng.c:43
word Random_Word(int fReset)
Definition rewire_rng.c:37
ABC_NAMESPACE_IMPL_START unsigned Random_Int(int fReset)
Definition rewire_rng.c:25