ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::utility::random::RandomContext Class Reference

Public Member Functions

 RandomContext (RandomContext const &)=delete
 
void operator= (RandomContext const &)=delete
 
void Seed (const int seed)
 Seed the random number generator (globally). More...
 
std::mt19937 * GetEngine ()
 
std::mutex * GetMutex ()
 Get global singleton mutex to protect the engine call. More...
 

Static Public Member Functions

static RandomContextGetInstance ()
 Returns the singleton instance. More...
 

Detailed Description

Global thread-safe singleton instance for random generation. Generates compiler/OS/device independent random numbers.

Definition at line 18 of file Random.cpp.

Constructor & Destructor Documentation

◆ RandomContext()

cloudViewer::utility::random::RandomContext::RandomContext ( RandomContext const &  )
delete

Member Function Documentation

◆ GetEngine()

std::mt19937* cloudViewer::utility::random::RandomContext::GetEngine ( )
inline

This is used by other downstream random generators. You must also lock the GetMutex() before calling the engine.

Definition at line 37 of file Random.cpp.

Referenced by cloudViewer::utility::random::GetEngine().

◆ GetInstance()

static RandomContext& cloudViewer::utility::random::RandomContext::GetInstance ( )
inlinestatic

Returns the singleton instance.

Definition at line 24 of file Random.cpp.

Referenced by cloudViewer::utility::random::GetEngine(), cloudViewer::utility::random::GetMutex(), and cloudViewer::utility::random::Seed().

◆ GetMutex()

std::mutex* cloudViewer::utility::random::RandomContext::GetMutex ( )
inline

Get global singleton mutex to protect the engine call.

Definition at line 40 of file Random.cpp.

Referenced by cloudViewer::utility::random::GetMutex().

◆ operator=()

void cloudViewer::utility::random::RandomContext::operator= ( RandomContext const &  )
delete

◆ Seed()

void cloudViewer::utility::random::RandomContext::Seed ( const int  seed)
inline

Seed the random number generator (globally).

Definition at line 30 of file Random.cpp.

Referenced by cloudViewer::utility::random::Seed().


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