OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
rand.h
Go to the documentation of this file.
1/*
2 * MT19937 random number generator seeded with timestamp counter and x86
3 * entropy sourcing instructions.
4 */
5
6#ifndef _SYS_RAND_H
7#define _SYS_RAND_H
8
9#include <stdint.h>
10
11#define MT19937_VECTOR_LEN 624
12
13typedef struct {
15 int index;
17
18/*
19 * @brief Initialize the MT19937 random number generator at *state.
20 */
22
23/*
24 * @brief Get a random, uniformally distributed 32-bit value from the MT19937
25 * random number generator at *state.
26 */
28
29/*
30 * @brief Seed the global random number generator.
31 */
32void srand(uint32_t seed);
33
34/*
35 * @brief Get a random, uniformally distributed 32-bit value.
36 */
37uint32_t rand(void);
38
39#endif
static struct keyboard_state state
Definition keyboard.c:8
void mt19937_init(mt19937_state *state, uint32_t seed)
Definition rand.c:25
uint32_t mt19937_gen32(mt19937_state *state)
Definition rand.c:36
#define MT19937_VECTOR_LEN
Definition rand.h:11
uint32_t rand(void)
Definition rand.c:131
void srand(uint32_t seed)
Definition rand.c:123
unsigned int uint32_t
Definition stdint.h:6
Definition rand.h:13
int index
Definition rand.h:15