Function gen_rand

Source
pub fn gen_rand(modulus: &BigUint) -> BigUint
Expand description

Generates a random BigUint number within the range [1, modulus).

This function creates a random number that is greater than or equal to 1 and less than the specified modulus. It uses the thread-local random number generator to ensure unpredictability and suitability for cryptographic applications where secure random number generation is crucial.

§Parameters

  • modulus: A reference to a BigUint that specifies the upper bound of the random number generation. The generated number will be in the range [1, modulus), meaning it includes 1 but excludes modulus.

§Returns

Returns a BigUint representing the randomly generated number within the specified range.