Open3D (C++ API)  0.18.0+5c982c7
Public Member Functions | Protected Attributes
open3d::utility::random::UniformRealGenerator< T > Class Template Reference

#include <Random.h>

Public Member Functions

 UniformRealGenerator (const T low=0.0, const T high=1.0)
 
operator() ()
 Call this to generate a uniformly distributed floating point value. More...
 

Protected Attributes

std::uniform_real_distribution< T > distribution_
 

Detailed Description

template<typename T>
class open3d::utility::random::UniformRealGenerator< T >

Generate uniformly distributed floating point values in [low, high). This class is globally seeded by utility::random::Seed(). This class is a wrapper around std::uniform_real_distribution.

Example:

// Globally seed Open3D. This will affect all random functions.
// Generate a random double in [0, 1).
utility::random::UniformRealGenerator<double> gen(0, 1);
for (size_t i = 0; i < 10; i++) {
std::cout << gen() << std::endl;
}
void Seed(const int seed)
Set Open3D global random seed.
Definition: Random.cpp:53

Constructor & Destructor Documentation

◆ UniformRealGenerator()

template<typename T >
open3d::utility::random::UniformRealGenerator< T >::UniformRealGenerator ( const T  low = 0.0,
const T  high = 1.0 
)
inline

Generate uniformly distributed floating point values in [low, high).

Parameters
lowThe lower bound (inclusive).
highThe upper bound (exclusive).

Member Function Documentation

◆ operator()()

template<typename T >
T open3d::utility::random::UniformRealGenerator< T >::operator() ( )
inline

Call this to generate a uniformly distributed floating point value.

Field Documentation

◆ distribution_

template<typename T >
std::uniform_real_distribution<T> open3d::utility::random::UniformRealGenerator< T >::distribution_
protected

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