lfsr.h
Go to the documentation of this file.
1 /******************************************************************************/
38 /******************************************************************************/
39 
40 #if !defined(_LFSR_H_)
41 #define _LFSR_H_
42 
43 #if defined(__cplusplus)
44 extern "C" {
45 #endif
46 
47 #include <stdint.h>
48 
52 typedef struct lfsr {
53  uint16_t start_state;
54  uint16_t lfsr_value;
55 } lfsr_t;
56 
66 void
68  uint16_t seed,
69  lfsr_t *instance
70 );
71 
79 uint16_t
81  lfsr_t *instance
82 );
83 
90 void
92  lfsr_t *instance
93 );
94 
95 #if defined(__cplusplus)
96 }
97 #endif
98 
99 #endif
uint16_t lfsr_get_next(lfsr_t *instance)
Generate the next random number.
Definition: lfsr.c:55
void lfsr_reset(lfsr_t *instance)
Reset the random number generator to it&#39;s initial state.
Definition: lfsr.c:75
void lfsr_init_start_state(uint16_t seed, lfsr_t *instance)
Initialize the seed for the random number generator.
Definition: lfsr.c:43
uint16_t lfsr_value
Definition: lfsr.h:54
An instance type for the random number generator.
Definition: lfsr.h:52
uint16_t start_state
Definition: lfsr.h:53
struct lfsr lfsr_t
An instance type for the random number generator.