RND: make random int functions public

This commit is contained in:
hasufell 2014-06-03 18:08:55 +02:00
parent 9b71469b51
commit e88dc81c90
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 18 additions and 2 deletions

View File

@ -38,7 +38,7 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
static int int
get_rnd_int(void) get_rnd_int(void)
{ {
int rnd_data = open("/dev/random", O_RDONLY); int rnd_data = open("/dev/random", O_RDONLY);
@ -62,7 +62,7 @@ get_rnd_int(void)
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
static int int
get_urnd_int(void) get_urnd_int(void)
{ {
int rnd_data = open("/dev/urandom", O_RDONLY); int rnd_data = open("/dev/urandom", O_RDONLY);

View File

@ -35,6 +35,22 @@
#include <fmpz_poly.h> #include <fmpz_poly.h>
/**
* Get a random integer from /dev/random.
*
* @return random integer
*/
int
get_rnd_int(void);
/**
* Get a pseudo random integer from /dev/urandom.
*
* @return pseudo-random integer.
*/
int
get_urnd_int(void);
/** /**
* Get a random ternary polynomial with specified numbers * Get a random ternary polynomial with specified numbers
* of 1 coefficients and -1 coefficients. * of 1 coefficients and -1 coefficients.