-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.h
43 lines (26 loc) · 919 Bytes
/
examples.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#if !defined(EXAMPLES_H_INCLUDED)
#include <stdint.h>
#define EXAMPLE_RAND_MAX (uint16_t)0xffff
/* basic generator -- 11 bytes of RAM and two multiplies per byte of output */
void basicrand_seed(void const *s, uint8_t l);
uint16_t basicrand(void);
/* Tiny generator -- 4 bytes of RAM, but two multiplies per byte */
void tinyrand_seed(void const *s, uint8_t l);
uint16_t tinyrand(void);
/* fast generator -- 8 bytes of RAM, one multiply per byte */
void fastrand_seed(void const *s, uint8_t l);
uint16_t fastrand(void);
/* shift generator -- like fast, but using shifts instead of multipliers (so, not fast) */
void shiftrand_seed(void const *s, uint8_t l);
uint16_t shiftrand(void);
typedef struct
{
void (*seed)(void const *seed, uint8_t length);
uint16_t (*gen)(void);
uint32_t a;
uint8_t r;
uint8_t *x;
uint16_t *c;
} example_ptr_t;
extern example_ptr_t examples[6];
#endif