Hi
These existing functions
Function: void mpf_random2 (mpf_t ROP, mp_size_t MAX_SIZE, mp_exp_t
EXP)
Generate a random float of at most MAX_SIZE limbs, with long
strings of zeros and ones in the binary representation. The
exponent of the number is in the interval -EXP to EXP (in limbs).
This function is useful for testing functions and algorithms,
since these kind of random numbers have proven to be more likely
to trigger corner-case bugs. Negative random numbers are
generated when MAX_SIZE is negative.
-- Function: void mpn_random (mp_limb_t *R1P, mp_size_t R1N)
-- Function: void mpn_random2 (mp_limb_t *R1P, mp_size_t R1N)
Generate a random number of length R1N and store it at R1P. The
most significant limb is always non-zero. `mpn_random' generates
uniformly distributed limb data, `mpn_random2' generates long
strings of zeros and ones in the binary representation.
`mpn_random2' is intended for testing the correctness of the `mpn'
routines.
do not accept a random state variable , hence I think they should be declared
obsolete. They use a global state ( which of course will break with
multi-threading) , we should of replace them with new functions which do
accept a gmp_randstate.
We allready have this mpf function
-- Function: void mpf_urandomb (mpf_t ROP, gmp_randstate_t STATE,
unsigned long int NBITS)
Generate a uniformly distributed random float in ROP, such that 0
<= ROP < 1, with NBITS significant bits in the mantissa.
The variable STATE must be initialized by calling one of the
`gmp_randinit' functions (*note Random State Initialization::)
before invoking this function.
so to "match" what we have for the mpz functions I think we should have a new
function
void mpf_rrandomb (mpf_t ROP, gmp_randstate_t STATE, unsigned long NBITS,
mp_exp_t EXP)
I not sure whether we need the EXP parameter or not ? any thoughts? ,
And for the mpn random functions (again mirroring the mpz fn's) I think
mpn_urandomm(mp_ptr rp, gmp_randstate_t STATE, mp_srcptr sp, mp_size_t n)
mpn_urandomb(mp_ptr rp, gmp_randstate_t STATE, mp_size_t rpn)
mpn_rrandomb(mp_ptr rp, gmp_randstate_t STATE, mp_size_t rpn)
Any thoughts?
Jason
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"mpir-devel" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/mpir-devel?hl=en
-~----------~----~----~----~------~----~------~--~---