libvisual  0.5.0
Public Types | Public Member Functions | List of all members
LV::RandomContext Class Reference

Pseudorandom number generator class. More...

#include <libvisual/lv_random.h>

Public Types

typedef RandomSeed Seed
 

Public Member Functions

 RandomContext (Seed seed)
 Creates a new RandomContext with a given seed. More...
 
 RandomContext (RandomContext const &)=delete
 
 RandomContext (RandomContext &&rhs)
 Move constructor.
 
 ~RandomContext ()
 Destructor.
 
RandomContextoperator= (RandomContext const &)=delete
 
RandomContextoperator= (RandomContext &&rhs)
 
void set_seed (uint32_t seed)
 Sets the seed. More...
 
uint32_t get_int ()
 Returns a random integer. More...
 
uint32_t get_int (unsigned int min, unsigned int max)
 Returns a random integer in a given range. More...
 
double get_double ()
 Returns a random double-precision floating point value between 0.0 and 1.0. More...
 
float get_float ()
 Returns a random single-precision floating point value between 0.0 and 1.0. More...
 

Detailed Description

Pseudorandom number generator class.

Definition at line 48 of file lv_random.h.

Constructor & Destructor Documentation

LV::RandomContext::RandomContext ( Seed  seed)
explicit

Creates a new RandomContext with a given seed.

Parameters
seedInitial seed for generating random number sequences

Definition at line 41 of file lv_random.cpp.

Member Function Documentation

double LV::RandomContext::get_double ( )

Returns a random double-precision floating point value between 0.0 and 1.0.

Returns
A random value between 0.0 and 1.0

Definition at line 90 of file lv_random.cpp.

float LV::RandomContext::get_float ( )

Returns a random single-precision floating point value between 0.0 and 1.0.

Returns
A random value between 0.0 and 1.0

Definition at line 112 of file lv_random.cpp.

Referenced by get_int().

uint32_t LV::RandomContext::get_int ( )

Returns a random integer.

Returns
A random integer

Definition at line 69 of file lv_random.cpp.

Referenced by get_int(), and LV::rand().

uint32_t LV::RandomContext::get_int ( unsigned int  min,
unsigned int  max 
)

Returns a random integer in a given range.

Parameters
minLower bound
maxUpper bound
Returns
A random integer between min and max inclusive

Definition at line 74 of file lv_random.cpp.

void LV::RandomContext::set_seed ( uint32_t  seed)

Sets the seed.

Parameters
seedNew seed

Definition at line 64 of file lv_random.cpp.

Referenced by RandomContext(), and LV::System::set_rng_seed().


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