linbox
|
Prime Iterator. More...
#include <random-prime.h>
Public Types | |
typedef UniqueSamplingTrait< Trait > | UniqueSamplingTag |
whether a prime can be picked more than once | |
Public Member Functions | |
PrimeIterator (uint64_t bits=23, uint64_t seed=0) | |
Constructor. More... | |
PrimeIterator< Trait > & | operator++ () |
operator++() (prefix ++ operator) creates a new random prime. | |
const Prime_Type & | operator* () const |
get the random prime. More... | |
void | setBits (uint64_t bits) |
Sets the bit size. More... | |
Static Public Member Functions | |
static void | setSeed (uint64_t ul) |
Sets the seed. More... | |
Protected Attributes | |
uint64_t | _bits |
common lenght of all primes | |
integer | _prime |
the generated prime. | |
Givaro::IntPrimeDom | _IPD |
empty struct dealing with primality. | |
Prime Iterator.
Generates prime of specified length using a heuristically random distribution (no guarantee whatsoever).
|
inline |
Constructor.
bits | size of primes (in bits). Default is 23 so it can fit in a Linbox::Modular<double> . |
seed | if 0 a seed will be generated, otherwise, the provided seed will be use. |
|
inline |
get the random prime.
returns the actual prime.
|
inlinestatic |
Sets the seed.
Set the random seed to be ul
.
ul | the new seed. |
|
inline |
Sets the bit size.
bits | the new bit size. |