FastLED  3.1
Fast random number generators

Fast 8- and 16- bit unsigned random numbers. More...

+ Collaboration diagram for Fast random number generators:

Functions

LIB8STATIC uint8_t random8 ()
 Generate an 8-bit random number.
 
LIB8STATIC uint16_t random16 ()
 Generate a 16 bit random number.
 
LIB8STATIC uint8_t random8 (uint8_t lim)
 Generate an 8-bit random number between 0 and lim. More...
 
LIB8STATIC uint8_t random8 (uint8_t min, uint8_t lim)
 Generate an 8-bit random number in the given range. More...
 
LIB8STATIC uint16_t random16 (uint16_t lim)
 Generate an 16-bit random number between 0 and lim. More...
 
LIB8STATIC uint16_t random16 (uint16_t min, uint16_t lim)
 Generate an 16-bit random number in the given range. More...
 
LIB8STATIC void random16_set_seed (uint16_t seed)
 Set the 16-bit seed used for the random number generator.
 
LIB8STATIC uint16_t random16_get_seed ()
 Get the current seed value for the random number generator.
 
LIB8STATIC void random16_add_entropy (uint16_t entropy)
 Add entropy into the random number generator.
 

Variables

uint16_t rand16seed
 random number seed
 

Detailed Description

Fast 8- and 16- bit unsigned random numbers.

Significantly faster than Arduino random(), but also somewhat less random. You can add entropy.

Function Documentation

LIB8STATIC uint16_t random16 ( uint16_t  lim)

Generate an 16-bit random number between 0 and lim.

Parameters
limthe upper bound for the result

Definition at line 56 of file random8.h.

LIB8STATIC uint16_t random16 ( uint16_t  min,
uint16_t  lim 
)

Generate an 16-bit random number in the given range.

Parameters
minthe lower bound for the random number
limthe upper bound for the random number

Definition at line 67 of file random8.h.

LIB8STATIC uint8_t random8 ( uint8_t  lim)

Generate an 8-bit random number between 0 and lim.

Parameters
limthe upper bound for the result

Definition at line 37 of file random8.h.

LIB8STATIC uint8_t random8 ( uint8_t  min,
uint8_t  lim 
)

Generate an 8-bit random number in the given range.

Parameters
minthe lower bound for the random number
limthe upper bound for the random number

Definition at line 47 of file random8.h.