|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
|
2 // |
|
3 // Copyright (C) 2001 Pierre L'Ecuyer (lecuyer@iro.umontreal.ca) |
|
4 // |
|
5 // This program is free software; you can redistribute it and/or modify |
|
6 // it under the terms of the GNU General Public License version 2 as |
|
7 // published by the Free Software Foundation; |
|
8 // |
|
9 // This program is distributed in the hope that it will be useful, |
|
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 // GNU General Public License for more details. |
|
13 // |
|
14 // You should have received a copy of the GNU General Public License |
|
15 // along with this program; if not, write to the Free Software |
|
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 // |
|
18 // Modified for ns-3 by: Rajib Bhattacharjea<raj.b@gatech.edu> |
|
19 |
|
20 #ifndef RNGSTREAM_H |
|
21 #define RNGSTREAM_H |
|
22 #include <string> |
|
23 |
|
24 namespace ns3{ |
|
25 |
|
26 /** |
|
27 * \brief RngStream by Pierre L'Ecuyer, University of Montreal |
|
28 * Adapted to NS3 by Rajib Bhattacharjea, Georgia Tech. |
|
29 */ |
|
30 class RngStream { |
|
31 public: //public api |
|
32 RngStream (); |
|
33 void InitializeStream(); // Separate initialization |
|
34 void ResetStartStream (); |
|
35 void ResetStartSubstream (); |
|
36 void ResetNextSubstream (); |
|
37 void SetAntithetic (bool a); |
|
38 void IncreasedPrecis (bool incp); |
|
39 bool SetSeeds (const uint32_t seed[6]); |
|
40 void AdvanceState (int32_t e, int32_t c); |
|
41 void GetState (uint32_t seed[6]) const; |
|
42 double RandU01 (); |
|
43 int32_t RandInt (int32_t i, int32_t j); |
|
44 public: //public static api |
|
45 static bool SetPackageSeed (const uint32_t seed[6]); |
|
46 static bool CheckSeed(const uint32_t seed[6]); |
|
47 private: //members |
|
48 double Cg[6], Bg[6], Ig[6]; |
|
49 bool anti, incPrec; |
|
50 double U01 (); |
|
51 double U01d (); |
|
52 private: //static data |
|
53 static double nextSeed[6]; |
|
54 }; |
|
55 |
|
56 };//namespace ns3 |
|
57 |
|
58 #endif |
|
59 |
|
60 |