1#ifndef __INC_LIB8TION_RANDOM_H
2#define __INC_LIB8TION_RANDOM_H
23#define FASTLED_RAND16_2053 ((uint16_t)(2053))
25#define FASTLED_RAND16_13849 ((uint16_t)(13849))
27#if defined(LIB8_ATTINY)
29#define APPLY_FASTLED_RAND16_2053(x) (x << 11) + (x << 2) + x
32#define APPLY_FASTLED_RAND16_2053(x) (x * FASTLED_RAND16_2053)
44 return (uint8_t)(((uint8_t)(
rand16seed & 0xFF)) +
66LIB8STATIC uint8_t
random8(uint8_t min, uint8_t lim) {
67 uint8_t delta = lim - min;
68 uint8_t r =
random8(delta) + min;
76 uint32_t p = (uint32_t)lim * (uint32_t)r;
84LIB8STATIC uint16_t
random16(uint16_t min, uint16_t lim) {
85 uint16_t delta = lim - min;
LIB8STATIC void random16_add_entropy(uint16_t entropy)
Add entropy into the random number generator.
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
uint16_t rand16seed
Seed for the random number generator functions.
LIB8STATIC uint16_t random16_get_seed()
Get the current seed value for the random number generator.
#define APPLY_FASTLED_RAND16_2053(x)
Multiplies a value by the pseudo-random multiplier.
#define FASTLED_RAND16_13849
Increment value for pseudo-random number generation.
LIB8STATIC void random16_set_seed(uint16_t seed)
Set the 16-bit seed used for the random number generator.