PatchworkOS
Loading...
Searching...
No Matches
rand.c File Reference
#include <kernel/drivers/rand.h>
#include <kernel/cpu/cpu.h>
#include <kernel/cpu/smp.h>
#include <kernel/log/log.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/cpuid.h>

Go to the source code of this file.

Functions

static uint64_t rand_gen_fallback (void *buffer, uint64_t size)
 
void rand_cpu_init (rand_cpu_ctx_t *ctx)
 Initializes the random number generator.
 
uint64_t rand_gen (void *buffer, uint64_t size)
 Fills a buffer with random bytes.
 

Variables

static atomic_uint64_t seed = ATOMIC_VAR_INIT(0x123456789ABCDEF0)
 

Function Documentation

◆ rand_gen_fallback()

static uint64_t rand_gen_fallback ( void *  buffer,
uint64_t  size 
)
static

Definition at line 13 of file rand.c.

References atomic_load, atomic_store, buffer, seed, and timer_uptime().

Referenced by rand_gen().

Variable Documentation

◆ seed

atomic_uint64_t seed = ATOMIC_VAR_INIT(0x123456789ABCDEF0)
static

Definition at line 11 of file rand.c.

Referenced by rand_gen_fallback(), and srand().