Template Class DiscreteUniformGeneratorImpl

Template Parameter Order

  1. typename VecType

Class Documentation

template<typename VecType>
class lbcrypto::DiscreteUniformGeneratorImpl

The class for Discrete Uniform Distribution generator over Zq.

Public Functions

DiscreteUniformGeneratorImpl() = default
~DiscreteUniformGeneratorImpl() = default
explicit DiscreteUniformGeneratorImpl(const typename VecType::Integer &modulus)

Constructor that sets the modulus (see SetModulus).

Parameters

modulus – The modulus of the distribution.

void SetModulus(const typename VecType::Integer &modulus)

Sets the modulus.

Parameters

modulus – The new modulus.

VecType::Integer GenerateInteger() const

Generates a random integer based on the modulus set for the Discrete Uniform Generator object.

Returns

A random integer uniformly distributed in [0, modulus).

VecType GenerateVector(const uint32_t size) const

Generates a vector of random integers using GenerateInteger()

Parameters

size – The number of values to generate.

Returns

A vector of random integers uniformly distributed in [0, modulus).

VecType GenerateVector(const uint32_t size, const typename VecType::Integer &modulus)

Sets the modulus of the generator and then generates a vector of random integers using GenerateInteger()

Parameters
  • size – The number of values to generate.

  • modulus – The new modulus, kept by the generator for subsequent calls.

Returns

A vector of random integers uniformly distributed in [0, modulus).