linbox
GmpRandomPrime Class Reference

generating random prime integers, using the gmp library. More...

#include <gmp-random-prime.h>

+ Inheritance diagram for GmpRandomPrime:

Public Types

typedef integer Prime_Type
 
typedef UniqueSamplingTrait< Trait > UniqueSamplingTag
 whether a prime can be picked more than once
 
typedef Trait IteratorTag
 

Public Member Functions

 GmpRandomPrime (const uint64_t bits=23, const uint64_t seed=0)
 
integer randomPrime ()
 
integerrandomPrime (integer &p)
 
PrimeIterator< Trait > & operator++ ()
 operator++() (prefix ++ operator) creates a new random prime.
 
const Prime_Typeoperator* () const
 get the random prime.
 
void setBits (uint64_t bits)
 Sets the bit size.
 
uint64_t getBits () const
 

Static Public Member Functions

static void setSeed (uint64_t ul)
 Sets the seed.
 

Protected Member Functions

virtual void generatePrime ()
 
void generatePrime ()
 
void generatePrime ()
 
void generatePrime ()
 

Protected Attributes

uint64_t _bits
 common lenght of all primes
 
integer _prime
 the generated prime.
 
Givaro::IntPrimeDom _IPD
 empty struct dealing with primality.
 

Detailed Description

generating random prime integers, using the gmp library.

via primeiterator

Member Typedef Documentation

◆ Prime_Type

template<class Trait = IteratorCategories::HeuristicTag>
typedef integer Prime_Type
inherited

◆ UniqueSamplingTag

template<class Trait = IteratorCategories::HeuristicTag>
typedef UniqueSamplingTrait<Trait> UniqueSamplingTag
inherited

whether a prime can be picked more than once

◆ IteratorTag

template<class Trait = IteratorCategories::HeuristicTag>
typedef Trait IteratorTag
inherited

Constructor & Destructor Documentation

◆ GmpRandomPrime()

GmpRandomPrime ( const uint64_t bits = 23,
const uint64_t seed = 0 )
inline

Member Function Documentation

◆ randomPrime() [1/2]

integer randomPrime ( )
inline

◆ randomPrime() [2/2]

integer & randomPrime ( integer & p)
inline

◆ generatePrime() [1/4]

◆ generatePrime() [2/4]

void generatePrime ( )
inlineprotectedinherited

◆ generatePrime() [3/4]

void generatePrime ( )
inlineprotectedinherited

◆ generatePrime() [4/4]

void generatePrime ( )
inlineprotectedinherited

◆ operator++()

template<class Trait = IteratorCategories::HeuristicTag>
PrimeIterator< Trait > & operator++ ( )
inlineinherited

operator++() (prefix ++ operator) creates a new random prime.

◆ operator*()

template<class Trait = IteratorCategories::HeuristicTag>
const Prime_Type & operator* ( ) const
inlineinherited

get the random prime.

returns the actual prime.

Warning
a new prime is not generated.

◆ setSeed()

template<class Trait = IteratorCategories::HeuristicTag>
static void setSeed ( uint64_t ul)
inlinestaticinherited

Sets the seed.

Set the random seed to be ul.

Parameters
ulthe new seed.

◆ setBits()

template<class Trait = IteratorCategories::HeuristicTag>
void setBits ( uint64_t bits)
inlineinherited

Sets the bit size.

Parameters
bitsthe new bit size.

◆ getBits()

template<class Trait = IteratorCategories::HeuristicTag>
uint64_t getBits ( ) const
inlineinherited

Field Documentation

◆ _bits

template<class Trait = IteratorCategories::HeuristicTag>
uint64_t _bits
protectedinherited

common lenght of all primes

◆ _prime

template<class Trait = IteratorCategories::HeuristicTag>
integer _prime
protectedinherited

the generated prime.

◆ _IPD

template<class Trait = IteratorCategories::HeuristicTag>
Givaro::IntPrimeDom _IPD
protectedinherited

empty struct dealing with primality.


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