~ubuntu-branches/ubuntu/quantal/ns3/quantal

« back to all changes in this revision

Viewing changes to ns-3.12.1/src/core/model/rng-stream.h

  • Committer: Package Import Robot
  • Author(s): YunQiang Su, Aron Xu, YunQiang Su, Upstream
  • Date: 2012-01-06 00:35:42 UTC
  • mfrom: (10.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20120106003542-vcn5g03mhapm991h
Tags: 3.13+dfsg-1
[ Aron Xu ]:
        add tag binary and binary-indep, 
  for not build doc when --binary-arch (Closes: #654493).
[ YunQiang Su ]
        add waf 1.5/1.6 source to debian directory, 
  and build waf from there (Closes: #642217).
[ Upstream ]
  Successfully link with --as-needed option (Closes: #642225).

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
#include <stdint.h>
24
 
 
25
 
namespace ns3 {
26
 
 
27
 
/**
28
 
 * \ingroup core
29
 
 * \ingroup randomvariable 
30
 
 *
31
 
 * \brief Combined Multiple-Recursive Generator MRG32k3a
32
 
 *
33
 
 * This class is the combined multiple-recursive random number
34
 
 * generator called MRG32k3a.  The ns3::RandomVariableBase class
35
 
 * holds a static instance of this class.  The details of this
36
 
 * class are explained in:
37
 
 * http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf
38
 
 */
39
 
class RngStream {
40
 
public:  //public api
41
 
  RngStream ();
42
 
  RngStream (const RngStream&);
43
 
  void InitializeStream (); // Separate initialization
44
 
  void ResetStartStream ();
45
 
  void ResetStartSubstream ();
46
 
  void ResetNextSubstream ();
47
 
  void ResetNthSubstream (uint32_t N);
48
 
  void SetAntithetic (bool a);
49
 
  void IncreasedPrecis (bool incp);
50
 
  bool SetSeeds (const uint32_t seed[6]);
51
 
  void AdvanceState (int32_t e, int32_t c);
52
 
  void GetState (uint32_t seed[6]) const;
53
 
  double RandU01 ();
54
 
  int32_t RandInt (int32_t i, int32_t j);
55
 
public: //public static api
56
 
  static bool SetPackageSeed (uint32_t seed);
57
 
  static bool SetPackageSeed (const uint32_t seed[6]);
58
 
  static void GetPackageSeed (uint32_t seed[6]);
59
 
  static void SetPackageRun (uint32_t run);
60
 
  static uint32_t GetPackageRun (void);
61
 
  static bool CheckSeed (const uint32_t seed[6]);
62
 
  static bool CheckSeed (uint32_t seed);
63
 
private: //members
64
 
  double Cg[6], Bg[6], Ig[6];
65
 
  bool anti, incPrec;
66
 
  double U01 ();
67
 
  double U01d ();
68
 
  static uint32_t EnsureGlobalInitialized (void);
69
 
private: //static data
70
 
  static double nextSeed[6];
71
 
};
72
 
 
73
 
} // namespace ns3
74
 
 
75
 
#endif
76
 
 
77