random_range Class Reference

#include <rangelib/random_range.hpp>

Inheritance diagram for random_range:

notional_range_tag

List of all members.


Detailed Description

This range class represents a range of random numbers.

It is categoried as a Notional Range

It could be used as follows

  // Create a range of 10 values, whose value are between -100 and +100
  stlsoft::random_range   r(10, -100, +100);

  // Dump them to stdout
  stlsoft::r_copy(r, std::ostream_iterator<int>(" "));

Notional Range methods

bool is_open () const
 Indicates whether the range is open.
value_type current () const
 Returns the current value in the range.
class_typeadvance ()
 Advances the current position in the range.
 operator operator_bool_type () const
 Indicates whether the range is open.
value_type operator* () const
 Returns the current value in the range.
class_typeoperator++ ()
 Advances the current position in the range.
class_type operator++ (int)
 Advances the current position in the range, returning a copy of the range prior to its being advanced.

Public Types

Types
typedef int value_type
typedef notional_range_tag range_tag_type
typedef random_range class_type

Public Member Functions

Construction
 random_range (size_t numValues, value_type minValue=0, value_type maxValue=RAND_MAX)
 Constructs a random range.
Attributes
value_type minimum () const
 The lower limit of the random number range.
value_type maximum () const
 The upper limit of the random number range.
Comparison
bool operator== (class_type const &) const
 Evaluates whether two ranges are equal.
bool operator!= (class_type const &rhs) const
 Evaluates whether two ranges are unequal.

Constructor & Destructor Documentation

random_range ( size_t  numValues,
value_type  minValue = 0,
value_type  maxValue = RAND_MAX 
) [inline]

Constructs a random range.

Parameters:
numValues The number of values in the range
minValue The lower limit of the random number range
maxValue The upper limit of the random number range

References STLSOFT_ASSERT.


Member Function Documentation

bool is_open (  )  const [inline]

Indicates whether the range is open.

value_type current (  )  const [inline]

Returns the current value in the range.

References STLSOFT_MESSAGE_ASSERT.

class_type& advance (  )  [inline]

Advances the current position in the range.

References STLSOFT_MESSAGE_ASSERT.

operator operator_bool_type (  )  const [inline]

Indicates whether the range is open.

value_type operator* (  )  const [inline]

Returns the current value in the range.

class_type& operator++ (  )  [inline]

Advances the current position in the range.

class_type operator++ ( int   )  [inline]

Advances the current position in the range, returning a copy of the range prior to its being advanced.

value_type minimum (  )  const [inline]

The lower limit of the random number range.

value_type maximum (  )  const [inline]

The upper limit of the random number range.

bool operator== ( class_type const &   )  const [inline]

Evaluates whether two ranges are equal.

bool operator!= ( class_type const &  rhs  )  const [inline]

Evaluates whether two ranges are unequal.


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

Generated on Thu Jun 10 08:58:34 2010 for STLSoft by  doxygen 1.5.6