A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
random-variable-stream-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
8
9#include "ns3/assert.h"
10#include "ns3/config.h"
11#include "ns3/log.h"
12#include "ns3/pointer.h"
13#include "ns3/random-variable-stream.h"
14
15/**
16 * @file
17 * @ingroup core-helpers
18 * @ingroup randomvariable
19 * ns3::RandomVariableStreamHelper implementation.
20 */
21
22namespace ns3
23{
24
25NS_LOG_COMPONENT_DEFINE("RandomVariableStreamHelper");
26
27int64_t
28RandomVariableStreamHelper::AssignStreams(std::string path, int64_t stream)
29{
31 NS_ASSERT(stream >= 0);
33
34 std::size_t i = 0;
35 for (; i < mc.GetN(); ++i)
36 {
37 PointerValue ptr = mc.Get(i);
39 NS_LOG_DEBUG("RandomVariableStream found: " << rvs << "; setting stream to "
40 << (stream + i));
41 rvs->SetStream(stream + i);
42 }
43 return i;
44}
45
46} // namespace ns3
hold a set of objects which match a specific search string.
Definition config.h:184
Ptr< Object > Get(std::size_t i) const
Definition config.cc:75
std::size_t GetN() const
Definition config.cc:68
AttributeValue implementation for Pointer.
Ptr< T > Get() const
Definition pointer.h:223
Smart pointer class similar to boost::intrusive_ptr.
static int64_t AssignStreams(std::string path, int64_t stream)
This helper method can be used to configure the stream number for one or more RNG streams.
The basic uniform Random Number Generator (RNG).
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
MatchContainer LookupMatches(std::string path)
Definition config.cc:991
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RandomVariableStreamHelper declaration.