1 // Requires: 2 // * gmp.h 3 #ifndef __PBC_RANDOM_H__ 4 #define __PBC_RANDOM_H__ 5 6 /*@manual pbcrandom 7 Sets 'filename' as a source of random bytes. For example, 8 on Linux one might use `/dev/random`. 9 */ 10 void pbc_random_set_file(char *filename); 11 12 /*@manual pbcrandom 13 Uses a determinstic random number generator, seeded with 'seed'. 14 */ 15 void pbc_random_set_deterministic(unsigned int seed); 16 17 /*@manual pbcrandom 18 Uses given function as a random number generator. 19 */ 20 void pbc_random_set_function(void (*fun)(mpz_t, mpz_t, void *), void *data); 21 22 /*@manual pbcrandom 23 Selects a random 'z' that is less than 'limit'. 24 */ 25 void pbc_mpz_random(mpz_t z, mpz_t limit); 26 27 /*@manual pbcrandom 28 Selects a random 'bits'-bit integer 'z'. 29 */ 30 void pbc_mpz_randomb(mpz_t z, unsigned int bits); 31 32 #endif //__PBC_RANDOM_H__ 33