STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Public Attributes
stapl::generators::rand_gen Struct Reference

Class for generating random numbers. More...

Public Member Functions

 rand_gen (unsigned int seed=get_location_id())
 
size_t rand (void)
 Generates a random number in the range [0, numeric_limits<size_t>::max()).
 
size_t rand (size_t max)
 Generates a random number in the range [0, max). More...
 
size_t rand (size_t min, size_t max)
 Generates a random number in the range [min, max). More...
 

Public Types

typedef boost::random::uniform_int_distribution< size_t > rng_dist_t
 

Public Attributes

boost::random::mt19937 m_rng
 

Detailed Description

Class for generating random numbers.

Generators that need to produce random numbers in a thread-safe way should inherit from this class and call this->rand(...) to get random numbers.

Constructor & Destructor Documentation

◆ rand_gen()

stapl::generators::rand_gen::rand_gen ( unsigned int  seed = get_location_id())
Parameters
seedThe seed for random-number generation.

Member Function Documentation

◆ rand() [1/2]

size_t stapl::generators::rand_gen::rand ( size_t  max)

Generates a random number in the range [0, max).

Parameters
maxThe maximum value of the output random number (exclusive).

◆ rand() [2/2]

size_t stapl::generators::rand_gen::rand ( size_t  min,
size_t  max 
)

Generates a random number in the range [min, max).

Parameters
minThe minimum value of the output random number.
maxThe maximum value of the output random number (exclusive).

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