plll  1.0
plll::arithmetic::NIntContext< IType >::UniformRNG Class Reference

A uniform random number generator frontend. More...

#include <arithmetic-nint.hpp>

Public Member Functions

void random (NInt< IType > &res, const NInt< IType > &bound)
 Creates a random native CPU integer in the range $[0, bound)$. More...
 
NInt< IType > random (const NInt< IType > &bound, const NIntContext< IType > &ic)
 Creates and returns a random native CPU integer in the range $[0, bound)$. More...
 
void randomBits (NInt< IType > &res, unsigned long bits)
 Creates random bits. More...
 
NInt< IType > randomBits (unsigned long bits, const NIntContext< IType > &ic)
 Creates random bits. More...
 
void randomLen (NInt< IType > &res, unsigned long bits)
 Creates a random integer of a fixed bit length. More...
 
NInt< IType > randomLen (unsigned long bits, const NIntContext< IType > &ic)
 Creates a random integer of a fixed bit length. More...
 
 UniformRNG (RandomNumberGenerator &rng) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
 Creates a new uniform random number generator based on the given random number generator.
 

Detailed Description

template<class IType>
class plll::arithmetic::NIntContext< IType >::UniformRNG

A uniform random number generator frontend.

See also
Uniform Random Number Generator

Definition at line 89 of file arithmetic-nint.hpp.

Member Function Documentation

template<class IType >
void plll::arithmetic::NIntContext< IType >::UniformRNG::random ( NInt< IType > &  res,
const NInt< IType > &  bound 
)
inline

Creates a random native CPU integer in the range $[0, bound)$.

Parameters
resWhere to store the result.
boundA bound on the maximal integer returned.

Definition at line 2355 of file arithmetic-nint.hpp.

template<class IType>
NInt<IType> plll::arithmetic::NIntContext< IType >::UniformRNG::random ( const NInt< IType > &  bound,
const NIntContext< IType > &  ic 
)
inline

Creates and returns a random native CPU integer in the range $[0, bound)$.

Parameters
boundA bound on the maximal integer returned.
icAn integer context.
Returns
The result.

Definition at line 119 of file arithmetic-nint.hpp.

template<class IType >
void plll::arithmetic::NIntContext< IType >::UniformRNG::randomBits ( NInt< IType > &  res,
unsigned long  bits 
)
inline

Creates random bits.

Parameters
resWill be filled with a random integer in range $[0, 2^{bits})$.
bitsThe number of bits.

Definition at line 2361 of file arithmetic-nint.hpp.

template<class IType>
NInt<IType> plll::arithmetic::NIntContext< IType >::UniformRNG::randomBits ( unsigned long  bits,
const NIntContext< IType > &  ic 
)
inline

Creates random bits.

Parameters
bitsThe number of bits.
icAn integer context.
Returns
A random integer in range $[0, 2^{bits})$.

Definition at line 141 of file arithmetic-nint.hpp.

template<class IType >
void plll::arithmetic::NIntContext< IType >::UniformRNG::randomLen ( NInt< IType > &  res,
unsigned long  bits 
)
inline

Creates a random integer of a fixed bit length.

Parameters
resWill be filled with a random integer in range $[2^{bits-1}, 2^{bits})$.
bitsThe number of bits.

Definition at line 2367 of file arithmetic-nint.hpp.

template<class IType>
NInt<IType> plll::arithmetic::NIntContext< IType >::UniformRNG::randomLen ( unsigned long  bits,
const NIntContext< IType > &  ic 
)
inline

Creates a random integer of a fixed bit length.

Parameters
bitsThe number of bits.
icAn integer context.
Returns
A random integer in range $[2^{bits-1}, 2^{bits})$.

Definition at line 163 of file arithmetic-nint.hpp.


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