Fast 8-bit and 16-bit unsigned random number generators.
Significantly faster than Arduino random(), but also somewhat less random. You can add entropy.
Pseudo-random number generation follows the form:
X(n+1) = (2053 * X(n)) + 13849)
◆ APPLY_FASTLED_RAND16_2053
Multiplies a value by the pseudo-random multiplier.
Definition at line 32 of file random8.h.
◆ FASTLED_RAND16_13849
#define FASTLED_RAND16_13849 ((uint16_t)(13849)) |
Increment value for pseudo-random number generation.
Definition at line 25 of file random8.h.
◆ FASTLED_RAND16_2053
#define FASTLED_RAND16_2053 ((uint16_t)(2053)) |
Multiplier value for pseudo-random number generation.
Definition at line 23 of file random8.h.
◆ random16() [1/3]
◆ random16() [2/3]
Generate an 16-bit random number between 0 and lim.
- Parameters
-
lim | the upper bound for the result, exclusive |
Definition at line 74 of file random8.h.
◆ random16() [3/3]
LIB8STATIC uint16_t random16 |
( |
uint16_t | min, |
|
|
uint16_t | lim ) |
Generate an 16-bit random number in the given range.
- Parameters
-
min | the lower bound for the random number, inclusive |
lim | the upper bound for the random number, exclusive |
Definition at line 84 of file random8.h.
◆ random16_add_entropy()
LIB8STATIC void random16_add_entropy |
( |
uint16_t | entropy | ) |
|
◆ random16_get_seed()
Get the current seed value for the random number generator.
Definition at line 94 of file random8.h.
◆ random16_set_seed()
LIB8STATIC void random16_set_seed |
( |
uint16_t | seed | ) |
|
◆ random8() [1/3]
◆ random8() [2/3]
Generate an 8-bit random number between 0 and lim.
- Parameters
-
lim | the upper bound for the result, exclusive |
Definition at line 57 of file random8.h.
◆ random8() [3/3]
LIB8STATIC uint8_t random8 |
( |
uint8_t | min, |
|
|
uint8_t | lim ) |
Generate an 8-bit random number in the given range.
- Parameters
-
min | the lower bound for the random number, inclusive |
lim | the upper bound for the random number, exclusive |
Definition at line 66 of file random8.h.
◆ rand16seed
Seed for the random number generator functions.
Definition at line 17 of file lib8tion.cpp.