# Visualization Library

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

[Home] [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:

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:

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/Random.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/Random.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:14.
Permission is granted to use this page to write and publish articles regarding Visualization Library.