A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
random-variable-stream-helper.h
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 */
7#ifndef RANDOM_VARIABLE_STREAM_HELPER_H
8#define RANDOM_VARIABLE_STREAM_HELPER_H
9
10#include <cstdint>
11#include <string>
12
13/**
14 * \file
15 * \ingroup core-helpers
16 * \ingroup randomvariable
17 * ns3::RandomVariableStreamHelper declaration.
18 */
19
20namespace ns3
21{
22
23/**
24 * \brief Helper class for static methods involving RandomVariableStream
25 */
27{
28 public:
29 /**
30 * This helper method can be used to configure the stream number for
31 * one or more RNG streams. The path passed in should correspond to
32 * an attribute path in the configuration system. It may contain wildcards
33 * and may ultimately match zero, one, or more than one object.
34 *
35 * The objects to match are of type PointerValue where the underlying
36 * type is of type Ptr<RandomVariableStream>.
37 *
38 * \code
39 * .AddAttribute ("Speed",
40 * "A random variable used to pick the speed of a random waypoint model.",
41 * StringValue("ns3::UniformRandomVariable[Min=0.3|Max=0.7]"),
42 * MakePointerAccessor (&RandomWaypointMobilityModel::m_speed),
43 * MakePointerChecker<RandomVariableStream> ())
44 *
45 * \endcode
46 *
47 * Usage would look (for node 3) like this:
48 * \code
49 * std::string path
50 * ("/$ns3::NodeListPriv/NodeList/3/$ns3::Node/$ns3::RandomWaypointMobilityModel/Speed/$ns3::UniformRandomVariable");
51 * int64_t retVal = RandomVariableStreamHelper::AssignStreams (path, 0);
52 * \endcode
53 *
54 * \return The number of streams set
55 * \param path (possibly wildcarded) path to a RandomVariableStream PointerValue
56 * \param stream stream number to set; must be non-negative
57 */
58 static int64_t AssignStreams(std::string path, int64_t stream);
59};
60
61} // namespace ns3
62
63#endif /* RANDOM_VARIABLE_STREAM_HELPER_H */
Helper class for static methods involving RandomVariableStream.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.