A Discrete-Event Network Simulator
API
ns3::RandomVariableStreamHelper Class Reference

Helper class for static methods involving RandomVariableStream. More...

#include "random-variable-stream-helper.h"

Static Public Member Functions

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. More...
 

Detailed Description

Helper class for static methods involving RandomVariableStream.

Definition at line 36 of file random-variable-stream-helper.h.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::RandomVariableStreamHelper::AssignStreams ( std::string  path,
int64_t  stream 
)
static

This helper method can be used to configure the stream number for one or more RNG streams.

The path passed in should correspond to an attribute path in the configuration system. It may contain wildcards and may ultimately match zero, one, or more than one object.

The objects to match are of type PointerValue where the underlying type is of type Ptr<RandomVariableStream>.

.AddAttribute ("Speed",
"A random variable used to pick the speed of a random waypoint model.",
StringValue("ns3::UniformRandomVariable[Min=0.3|Max=0.7]"),
MakePointerChecker<RandomVariableStream> ())
Ptr< RandomVariableStream > m_speed
random variable to generate speeds
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:227

Usage would look (for node 3) like this:

std::string path ("/$ns3::NodeListPriv/NodeList/3/$ns3::Node/$ns3::RandomWaypointMobilityModel/Speed/$ns3::UniformRandomVariable");
int64_t retVal = RandomVariableStreamHelper::AssignStreams (path, 0);
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.
Returns
The number of streams set
Parameters
path(possibly wildcarded) path to a RandomVariableStream PointerValue
streamstream number to set; must be non-negative

Definition at line 37 of file random-variable-stream-helper.cc.

References ns3::Config::MatchContainer::Get(), ns3::PointerValue::Get(), ns3::Config::MatchContainer::GetN(), ns3::Config::LookupMatches(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION_NOARGS, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: