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 
40 namespace ns3 {
41 
42 class RandomVariableBase;
43 
59 {
60 public:
61  RandomVariable ();
64  ~RandomVariable ();
65 
70  double GetValue (void) const;
71 
76  uint32_t GetInteger (void) const;
77 
78 private:
79  friend std::ostream & operator << (std::ostream &os, const RandomVariable &var);
80  friend std::istream & operator >> (std::istream &os, RandomVariable &var);
81 
83 protected:
84  RandomVariable (const RandomVariableBase &variable);
85  RandomVariableBase * Peek (void) const;
86 };
87 
104 {
105 public:
110  UniformVariable ();
111 
117  UniformVariable (double s, double l);
118 
128  double GetValue (void) const;
129 
136  double GetValue (double s, double l);
137 
144  uint32_t GetInteger (uint32_t s, uint32_t l);
145 };
146 
155 {
156 
157 public:
161  ConstantVariable ();
162 
168  ConstantVariable (double c);
169 
174  void SetConstant (double c);
175 
176 };
177 
188 {
189 public:
201  SequentialVariable (double f, double l, double i = 1, uint32_t c = 1);
202 
213  SequentialVariable (double f, double l, const RandomVariable& i, uint32_t c = 1);
214 
215 };
216 
241 {
242 public:
248 
253  explicit ExponentialVariable (double m);
254 
266  ExponentialVariable (double m, double b);
267 
268 };
269 
291 {
292 public:
297  ParetoVariable ();
298 
305  explicit ParetoVariable (double m);
306 
314  ParetoVariable (double m, double s);
315 
328  ParetoVariable (double m, double s, double b);
329 
336  ParetoVariable (std::pair<double, double> params);
337 
350  ParetoVariable (std::pair<double, double> params, double b);
351 
352 };
353 
369 {
370 public:
375  WeibullVariable ();
376 
377 
383  WeibullVariable (double m);
384 
391  WeibullVariable (double m, double s);
392 
404  WeibullVariable (double m, double s, double b);
405 
406 };
407 
423 {
424 public:
429  NormalVariable ();
430 
436  NormalVariable (double m, double v);
437 
445  NormalVariable (double m, double v, double b);
446 };
447 
464 {
465 public:
469  explicit EmpiricalVariable ();
470 
476  void CDF (double v, double c); // Value, prob <= Value
477 protected:
478  EmpiricalVariable (const RandomVariableBase &variable);
479 };
480 
491 {
492 public:
494 };
495 
506 {
507 public:
519  explicit DeterministicVariable (double* d, uint32_t c);
520 };
521 
545 {
546 public:
551  LogNormalVariable (double mu, double sigma);
552 };
553 
570 {
571 public:
575  GammaVariable ();
576 
581  GammaVariable (double alpha, double beta);
582 
592  double GetValue (void) const;
593 
600  double GetValue (double alpha, double beta) const;
601 };
602 
623 {
624 public:
628  ErlangVariable ();
629 
634  ErlangVariable (unsigned int k, double lambda);
635 
645  double GetValue (void) const;
646 
653  double GetValue (unsigned int k, double lambda) const;
654 };
655 
672 {
673 public:
679  ZipfVariable (long N, double alpha);
683  ZipfVariable ();
684 };
685 
699 {
700 public:
705  ZetaVariable (double alpha);
709  ZetaVariable ();
710 };
711 
720 {
721 public:
727 
735  TriangularVariable (double s, double l, double mean);
736 
737 };
738 
739 std::ostream & operator << (std::ostream &os, const RandomVariable &var);
740 std::istream & operator >> (std::istream &os, RandomVariable &var);
741 
750 
751 } // namespace ns3
752 
753 #endif /* NS3_RANDOM_VARIABLE_H */