Givaro 4.2.1
RandomIntegerIterator< _Unsigned, _Exact_Size > Class Template Reference

Random Integer Iterator. More...

#include <random-integer.h>

Public Types

typedef Givaro::Integer Integer_Type
 
typedef Givaro::Integer Element
 
typedef Givaro::Integer Residu_t
 
typedef Givaro::ZRing< IntegerInteger_Domain
 

Public Member Functions

 RandomIntegerIterator (const Integer_Domain &D, uint64_t seed=0)
 Constructor.
 
 RandomIntegerIterator (const Integer_Domain &D, uint64_t seed, const Integer &samplesize)
 Constructor.
 
 RandomIntegerIterator (const RandomIntegerIterator &R)
 copy constructor.
 
RandomIntegerIteratoroperator= (const RandomIntegerIterator &R)
 copy.
 
RandomIntegerIteratoroperator++ ()
 operator++() creates a new random integer.
 
const Integer_Typeoperator* () const
 get the random integer.
 
const Integer_TyperandomInteger () const
 get the random integer.
 
Integer_Typerandom (Integer_Type &a) const
 
Elementoperator() (Element &a) const
 
Element operator() () const
 
Element random () const
 
void setBitsize (size_t bits)
 
size_t getBitsize () const
 
const Integer_Domainring () const
 

Static Public Member Functions

static void setSeed (uint64_t ul)
 Sets the seed *** globally *** WARNING: i.e.
 

Protected Member Functions

Integer_TypenextRandom (std::true_type, Integer_Type &a) const
 
Integer_TypenextRandom (std::false_type, Integer_Type &a) const
 

Protected Attributes

size_t _bits
 common length of all integers
 
Integer_Type _integer
 the generated integer.
 
const Integer_Domain_ring
 

Detailed Description

template<bool _Unsigned = true, bool _Exact_Size = false>
class Givaro::RandomIntegerIterator< _Unsigned, _Exact_Size >

Random Integer Iterator.

Generates integers of specified length.

Template Parameters
_Unsignedif true, then only non negative integers are generated, if false, their sign is random.
_Exact_Sizeif true, then random integers have exactly the number of required bits, if false, they have less than the required number of bits WARNING, the seed is *** global *** WARNING: i.e. sets the seed for all Givaro Integer

Member Typedef Documentation

◆ Integer_Type

template<bool _Unsigned = true, bool _Exact_Size = false>
typedef Givaro::Integer Integer_Type

◆ Element

template<bool _Unsigned = true, bool _Exact_Size = false>
typedef Givaro::Integer Element

◆ Residu_t

template<bool _Unsigned = true, bool _Exact_Size = false>
typedef Givaro::Integer Residu_t

◆ Integer_Domain

template<bool _Unsigned = true, bool _Exact_Size = false>
typedef Givaro::ZRing<Integer> Integer_Domain

Constructor & Destructor Documentation

◆ RandomIntegerIterator() [1/3]

template<bool _Unsigned = true, bool _Exact_Size = false>
RandomIntegerIterator ( const Integer_Domain & D,
uint64_t seed = 0 )
inline

Constructor.

Parameters
seedif 0 a seed will be generated, otherwise, the provided seed will be used, *** globally *** Default bit size (30) can be changed with method 'setBitsize'

◆ RandomIntegerIterator() [2/3]

template<bool _Unsigned = true, bool _Exact_Size = false>
RandomIntegerIterator ( const Integer_Domain & D,
uint64_t seed,
const Integer & samplesize )
inline

Constructor.

Parameters
seedif 0 a seed will be generated, otherwise, the provided seed will be used, *** globally ***
samplesizeis number ofpossible random values

◆ RandomIntegerIterator() [3/3]

template<bool _Unsigned = true, bool _Exact_Size = false>
RandomIntegerIterator ( const RandomIntegerIterator< _Unsigned, _Exact_Size > & R)
inline

copy constructor.

Parameters
Rrandom iterator to be copied.

Member Function Documentation

◆ operator=()

template<bool _Unsigned = true, bool _Exact_Size = false>
RandomIntegerIterator & operator= ( const RandomIntegerIterator< _Unsigned, _Exact_Size > & R)
inline

copy.

Parameters
Rrandom iterator to be copied.

◆ operator++()

template<bool _Unsigned = true, bool _Exact_Size = false>
RandomIntegerIterator & operator++ ( )
inline

operator++() creates a new random integer.

◆ operator*()

template<bool _Unsigned = true, bool _Exact_Size = false>
const Integer_Type & operator* ( ) const
inline

get the random integer.

returns the actual integer.

◆ randomInteger()

template<bool _Unsigned = true, bool _Exact_Size = false>
const Integer_Type & randomInteger ( ) const
inline

get the random integer.

returns the actual integer.

Warning
a new integer is not generated.

◆ random() [1/2]

template<bool _Unsigned = true, bool _Exact_Size = false>
Integer_Type & random ( Integer_Type & a) const
inline

◆ operator()() [1/2]

template<bool _Unsigned = true, bool _Exact_Size = false>
Element & operator() ( Element & a) const
inline

◆ operator()() [2/2]

template<bool _Unsigned = true, bool _Exact_Size = false>
Element operator() ( ) const
inline

◆ random() [2/2]

template<bool _Unsigned = true, bool _Exact_Size = false>
Element random ( ) const
inline

◆ setSeed()

template<bool _Unsigned = true, bool _Exact_Size = false>
static void setSeed ( uint64_t ul)
inlinestatic

Sets the seed *** globally *** WARNING: i.e.

sets the seed for all Givaro Integer Set the random seed to be ul.

Parameters
ulthe new seed.

◆ setBitsize()

template<bool _Unsigned = true, bool _Exact_Size = false>
void setBitsize ( size_t bits)
inline

◆ getBitsize()

template<bool _Unsigned = true, bool _Exact_Size = false>
size_t getBitsize ( ) const
inline

◆ ring()

template<bool _Unsigned = true, bool _Exact_Size = false>
const Integer_Domain & ring ( ) const
inline

◆ nextRandom() [1/2]

template<bool _Unsigned = true, bool _Exact_Size = false>
Integer_Type & nextRandom ( std::true_type ,
Integer_Type & a ) const
inlineprotected

◆ nextRandom() [2/2]

template<bool _Unsigned = true, bool _Exact_Size = false>
Integer_Type & nextRandom ( std::false_type ,
Integer_Type & a ) const
inlineprotected

Field Documentation

◆ _bits

template<bool _Unsigned = true, bool _Exact_Size = false>
size_t _bits
protected

common length of all integers

◆ _integer

template<bool _Unsigned = true, bool _Exact_Size = false>
Integer_Type _integer
protected

the generated integer.

◆ _ring

template<bool _Unsigned = true, bool _Exact_Size = false>
const Integer_Domain& _ring
protected

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