defined seeded-rand fns
This commit is contained in:
parent
25113dc0b3
commit
e363eccc59
@ -18,6 +18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <why2/crypto.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <sys/types.h>
|
||||
@ -51,3 +52,13 @@ ssize_t why2_random(void *dest, size_t size)
|
||||
{
|
||||
return getrandom(dest, size, GRND_NONBLOCK);
|
||||
}
|
||||
|
||||
void why2_seed_random(unsigned int seed)
|
||||
{
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
int why2_seeded_random()
|
||||
{
|
||||
return rand();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user