A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
core
examples
sample-random-variable.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License version 2 as
5
* published by the Free Software Foundation;
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*/
16
#include "ns3/simulator.h"
17
#include "ns3/nstime.h"
18
#include "ns3/command-line.h"
19
#include "ns3/random-variable-stream.h"
20
#include <iostream>
21
29
using namespace
ns3
;
30
60
int
main (
int
argc,
char
*argv[])
61
{
62
CommandLine
cmd
;
63
cmd
.Parse (argc, argv);
64
65
// SeedManager::SetRun (3);
66
67
Ptr<UniformRandomVariable>
uv = CreateObject<UniformRandomVariable> ();
68
69
std::cout << uv->
GetValue
() << std::endl;
70
71
}
ns3::Ptr< UniformRandomVariable >
second.cmd
cmd
Definition:
second.py:35
ns3::CommandLine
Parse command-line arguments.
Definition:
command-line.h:213
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::UniformRandomVariable::GetValue
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Definition:
random-variable-stream.cc:181
Generated on Wed Nov 7 2018 10:01:49 for ns-3 by
1.8.14