Random number generation, memory allocation, logging.
The first time PBC is asked to generate a random number,
the library will try to open the file
/dev/urandom as a
source of random bits. If this fails, PBC falls back to a deterministic
random number generator (which is of course completely useless for
It is possible to change the file used for random bits. Also, explicitly selecting the deterministic random number generator will suppress the warning.
On Windows, by default, PBC uses the Microsoft Crypto API to generate random bits.
void pbc_random_set_file(char *filename)
Sets filename as a source of random bytes. For example, on Linux one might use
void pbc_random_set_deterministic(unsigned int seed)
Uses a determinstic random number generator, seeded with seed.
void pbc_random_set_function(void (*fun)(mpz_t, mpz_t, void *), void *data)
Uses given function as a random number generator.
void pbc_mpz_random(mpz_t z, mpz_t limit)
Selects a random z that is less than limit.
void pbc_mpz_randomb(mpz_t z, unsigned int bits)
Selects a random bits-bit integer z.