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