Gazebo Math
API Reference
8.1.0
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-math
include
gz
math
Rand.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2012 Open Source Robotics Foundation
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
#ifndef GZ_MATH_RAND_HH_
18
#define GZ_MATH_RAND_HH_
19
20
#include <random>
21
#include <cmath>
22
#include <cstdint>
23
#include <
gz/math/Helpers.hh
>
24
#include <gz/math/config.hh>
25
26
namespace
gz::math
27
{
28
// Inline bracket to help doxygen filtering.
29
inline
namespace
GZ_MATH_VERSION_NAMESPACE {
30
//
33
typedef
std::mt19937
GeneratorType
;
36
typedef
std::uniform_real_distribution<double>
UniformRealDist
;
39
typedef
std::normal_distribution<double>
NormalRealDist
;
42
typedef
std::uniform_int_distribution<int32_t>
UniformIntDist
;
43
46
class
GZ_MATH_VISIBLE
Rand
47
{
51
public
:
static
void
Seed
(
unsigned
int
_seed
);
52
56
public
:
static
unsigned
int
Seed
();
57
61
public
:
static
double
DblUniform
(
double
_min
= 0,
double
_max
= 1);
62
66
public
:
static
double
DblNormal
(
double
_mean
= 0,
double
_sigma
= 1);
67
71
public
:
static
int32_t
IntUniform
(
int
_min
,
int
_max
);
72
76
public
:
static
int32_t
IntNormal
(
int
_mean
,
int
_sigma
);
77
80
private
:
static
uint32_t &SeedMutable();
81
84
private
:
static
GeneratorType
&RandGenerator();
85
};
86
}
// namespace GZ_MATH_VERSION_NAMESPACE
87
}
// namespace gz::math
88
#endif
// GZ_MATH_RAND_HH_