Givaro
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
RandomIntegerIterator< _Unsigned, _Exact_Size > Class Template Reference

Random Integer Iterator. More...

#include <random-integer.h>

+ Collaboration diagram for RandomIntegerIterator< _Unsigned, _Exact_Size >:

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. More...
 
 RandomIntegerIterator (const Integer_Domain &D, uint64_t seed, const Integer &samplesize)
 Constructor. More...
 
 RandomIntegerIterator (const RandomIntegerIterator &R)
 copy constructor. More...
 
RandomIntegerIteratoroperator= (const RandomIntegerIterator &R)
 copy. More...
 
RandomIntegerIteratoroperator++ ()
 operator++() creates a new random integer. More...
 
const Integer_Typeoperator* () const
 get the random integer. More...
 
const Integer_TyperandomInteger () const
 get the random integer. More...
 
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. More...
 

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 More...
 
Integer_Type _integer
 the generated integer. More...
 
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

◆ Element

◆ Residu_t

◆ Integer_Domain

Constructor & Destructor Documentation

◆ RandomIntegerIterator() [1/3]

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]

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]

RandomIntegerIterator ( const RandomIntegerIterator< _Unsigned, _Exact_Size > &  R)
inline

copy constructor.

Parameters
Rrandom iterator to be copied.

Member Function Documentation

◆ operator=()

RandomIntegerIterator& operator= ( const RandomIntegerIterator< _Unsigned, _Exact_Size > &  R)
inline

copy.

Parameters
Rrandom iterator to be copied.

◆ operator++()

RandomIntegerIterator& operator++ ( )
inline

operator++() creates a new random integer.

◆ operator*()

const Integer_Type& operator* ( ) const
inline

get the random integer.

returns the actual integer.

◆ randomInteger()

const Integer_Type& randomInteger ( ) const
inline

get the random integer.

returns the actual integer.

Warning
a new integer is not generated.

◆ random() [1/2]

Integer_Type& random ( Integer_Type a) const
inline

◆ operator()() [1/2]

Element& operator() ( Element a) const
inline

◆ operator()() [2/2]

Element operator() ( ) const
inline

◆ random() [2/2]

Element random ( ) const
inline

◆ setSeed()

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()

void setBitsize ( size_t  bits)
inline

◆ getBitsize()

size_t getBitsize ( ) const
inline

◆ ring()

const Integer_Domain& ring ( ) const
inline

◆ nextRandom() [1/2]

Integer_Type& nextRandom ( std::true_type  ,
Integer_Type a 
) const
inlineprotected

◆ nextRandom() [2/2]

Integer_Type& nextRandom ( std::false_type  ,
Integer_Type a 
) const
inlineprotected

Field Documentation

◆ _bits

size_t _bits
protected

common length of all integers

◆ _integer

Integer_Type _integer
protected

the generated integer.

◆ _ring

const Integer_Domain& _ring
protected

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