defined seeded-rand fns

This commit is contained in:
Václav Šmejkal 2025-01-10 17:55:45 +01:00
parent 25113dc0b3
commit e363eccc59
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -18,6 +18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <why2/crypto.h> #include <why2/crypto.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <sys/types.h> #include <sys/types.h>
@ -50,4 +51,14 @@ unsigned long long why2_sum_segment(char *input) //THE OUTPUT IS GOING TO GROW A
ssize_t why2_random(void *dest, size_t size) ssize_t why2_random(void *dest, size_t size)
{ {
return getrandom(dest, size, GRND_NONBLOCK); return getrandom(dest, size, GRND_NONBLOCK);
}
void why2_seed_random(unsigned int seed)
{
srand(seed);
}
int why2_seeded_random()
{
return rand();
} }