A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
random-variable.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2006 Georgia Tech Research Corporation
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 // Author: Rajib Bhattacharjea<raj.b@gatech.edu>
19 // Author: Hadi Arbabi<marbabi@cs.odu.edu>
20 //
21 
22 #ifndef NS3_RANDOM_VARIABLE_H
23 #define NS3_RANDOM_VARIABLE_H
24 
25 #include <vector>
26 #include <algorithm>
27 #include <stdint.h>
28 #include <istream>
29 #include <ostream>
30 #include "attribute.h"
31 #include "attribute-helper.h"
32 #include "rng-seed-manager.h"
33 
39 namespace ns3 {
40 
44 class RandomVariableBase;
45 
61 {
62 public:
63  RandomVariable ();
66  ~RandomVariable ();
67 
72  double GetValue (void) const;
73 
78  uint32_t GetInteger (void) const;
79 
80 private:
81  friend std::ostream & operator << (std::ostream &os, const RandomVariable &var);
82  friend std::istream & operator >> (std::istream &os, RandomVariable &var);
83 
85 protected:
86  RandomVariable (const RandomVariableBase &variable);
87  RandomVariableBase * Peek (void) const;
88 };
89 
106 {
107 public:
112  UniformVariable ();
113 
119  UniformVariable (double s, double l);
120 
130  double GetValue (void) const;
131 
138  double GetValue (double s, double l);
139 
146  uint32_t GetInteger (uint32_t s, uint32_t l);
147 };
148 
157 {
158 
159 public:
163  ConstantVariable ();
164 
170  ConstantVariable (double c);
171 
176  void SetConstant (double c);
177 
178 };
179 
190 {
191 public:
203  SequentialVariable (double f, double l, double i = 1, uint32_t c = 1);
204 
215  SequentialVariable (double f, double l, const RandomVariable& i, uint32_t c = 1);
216 
217 };
218 
243 {
244 public:
250 
255  explicit ExponentialVariable (double m);
256 
268  ExponentialVariable (double m, double b);
269 
270 };
271 
293 {
294 public:
299  ParetoVariable ();
300 
307  explicit ParetoVariable (double m);
308 
316  ParetoVariable (double m, double s);
317 
330  ParetoVariable (double m, double s, double b);
331 
338  ParetoVariable (std::pair<double, double> params);
339 
352  ParetoVariable (std::pair<double, double> params, double b);
353 
354 };
355 
371 {
372 public:
377  WeibullVariable ();
378 
379 
385  WeibullVariable (double m);
386 
393  WeibullVariable (double m, double s);
394 
406  WeibullVariable (double m, double s, double b);
407 
408 };
409 
425 {
426 public:
431  NormalVariable ();
432 
438  NormalVariable (double m, double v);
439 
447  NormalVariable (double m, double v, double b);
448 };
449 
466 {
467 public:
471  explicit EmpiricalVariable ();
472 
478  void CDF (double v, double c); // Value, prob <= Value
479 protected:
480  EmpiricalVariable (const RandomVariableBase &variable);
481 };
482 
493 {
494 public:
496 };
497 
508 {
509 public:
521  explicit DeterministicVariable (double* d, uint32_t c);
522 };
523 
547 {
548 public:
553  LogNormalVariable (double mu, double sigma);
554 };
555 
572 {
573 public:
577  GammaVariable ();
578 
583  GammaVariable (double alpha, double beta);
584 
594  double GetValue (void) const;
595 
602  double GetValue (double alpha, double beta) const;
603 };
604 
625 {
626 public:
630  ErlangVariable ();
631 
636  ErlangVariable (unsigned int k, double lambda);
637 
647  double GetValue (void) const;
648 
655  double GetValue (unsigned int k, double lambda) const;
656 };
657 
674 {
675 public:
681  ZipfVariable (long N, double alpha);
685  ZipfVariable ();
686 };
687 
701 {
702 public:
707  ZetaVariable (double alpha);
711  ZetaVariable ();
712 };
713 
722 {
723 public:
729 
737  TriangularVariable (double s, double l, double mean);
738 
739 };
740 
741 std::ostream & operator << (std::ostream &os, const RandomVariable &var);
742 std::istream & operator >> (std::istream &os, RandomVariable &var);
743 
752 
753 } // namespace ns3
754 
755 #endif /* NS3_RANDOM_VARIABLE_H */