Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions

vl::Random Class Reference

Cryptographic random number generator. More...

#include <Random.hpp>

Inheritance diagram for vl::Random:
vl::Object

List of all members.

Public Member Functions

 Random ()
 Constructor.
virtual ~Random ()
 Destructor.
virtual bool fillRandom (void *ptr, size_t bytes) const
 Fills the specified buffer with random data generated using the best quality random number generation facilities available.
void fillRandomMersenneTwister (void *ptr, size_t bytes) const
 Fills the specified buffer with random data generated using a defMersienneTwister().

Detailed Description

Cryptographic random number generator.

For non-ryptographic fast and high quality random number generation use vl::MersenneTwister.

Definition at line 41 of file Random.hpp.


Constructor & Destructor Documentation

Random::Random (  )

Constructor.

Definition at line 45 of file Random.cpp.

References NULL, and VL_DEBUG_SET_OBJECT_NAME.

Random::~Random (  ) [virtual]

Destructor.

Definition at line 57 of file Random.cpp.

References NULL.


Member Function Documentation

bool Random::fillRandom ( void *  ptr,
size_t  bytes 
) const [virtual]

Fills the specified buffer with random data generated using the best quality random number generation facilities available.

Under Windows (including MinGW) CryptGenRandom is used, while under Unix-like operating systems /dev/urandom is used. If no special random number generation facility is detected the function falls back to use a MersenneTwister.

Returns:
This method returns false if the function had to fallback to MersenneTwister otherwise returns true.

Definition at line 74 of file Random.cpp.

References fillRandomMersenneTwister().

Referenced by vl::UUID::generateVersion4().

void Random::fillRandomMersenneTwister ( void *  ptr,
size_t  bytes 
) const

Fills the specified buffer with random data generated using a defMersienneTwister().

MersienneTwister produces high quality random number and can be much faster than fillRandom().

Definition at line 98 of file Random.cpp.

References vl::defMersenneTwister(), and vl::MersenneTwister::randInt().

Referenced by fillRandom().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:07.
Permission is granted to use this page to write and publish articles regarding Visualization Library.