Open3D (C++ API)  0.18.0+252c867
Data Structures | Functions
open3d::utility::random Namespace Reference

Data Structures

class  RandomContext
 
class  UniformIntGenerator
 
class  UniformRealGenerator
 
class  NormalGenerator
 
class  DiscreteGenerator
 

Functions

void Seed (const int seed)
 Set Open3D global random seed. More...
 
std::mt19937 * GetEngine ()
 
std::mutex * GetMutex ()
 
uint32_t RandUint32 ()
 

Function Documentation

◆ GetEngine()

std::mt19937 * open3d::utility::random::GetEngine ( )

Get global singleton random engine. You must also lock the global mutex before calling the engine.

Example:

{
// Put the lock and the call to the engine in the same scope.
std::lock_guard<std::mutex> lock(*utility::random::GetMutex());
std::shuffle(vals.begin(), vals.end(), *utility::random::GetEngine());
}
std::mt19937 * GetEngine()
Definition: Random.cpp:55
std::mutex * GetMutex()
Definition: Random.cpp:57

◆ GetMutex()

std::mutex * open3d::utility::random::GetMutex ( )

Get global singleton mutex to protect the engine call. Also see random::GetEngine().

◆ RandUint32()

uint32_t open3d::utility::random::RandUint32 ( )

Generate a random uint32. This function is globally seeded by utility::random::Seed(). This function is automatically protected by the global random mutex.

◆ Seed()

void open3d::utility::random::Seed ( const int  seed)

Set Open3D global random seed.