Wirepas SDK
random.h File Reference

Go to the source code of this file.

Functions

void Random_init (uint32_t seed)
 Initialize the random generator. More...
 
uint8_t Random_get8 (void)
 Get random number with u8 range. More...
 
uint16_t Random_get16 (void)
 Get random number with u16 range. More...
 
uint32_t Random_get32 (void)
 Get random number with u32 range. More...
 

Macros

#define Random_get()   Random_get8()
 
#define Random_jitter(x)   (Random_get32() % (((x) + 1 ) & 0xFFFFFFF))
 Generate random jitter. More...
 

Function Documentation

◆ Random_get16()

uint16_t Random_get16 ( void  )

Get random number with u16 range.

Returns
Random number between [0...U16_MAX]

◆ Random_get32()

uint32_t Random_get32 ( void  )

Get random number with u32 range.

Returns
Random number between [0...U32_MAX]

◆ Random_get8()

uint8_t Random_get8 ( void  )

Get random number with u8 range.

Returns
Random number between [0...U8_MAX]

◆ Random_init()

void Random_init ( uint32_t  seed)

Initialize the random generator.

Parameters
seedInitialization seed

Macro Definition Documentation

◆ Random_get

#define Random_get ( )    Random_get8()

Definition at line 20 of file random.h.

◆ Random_jitter

#define Random_jitter (   x)    (Random_get32() % (((x) + 1 ) & 0xFFFFFFF))

Generate random jitter.

Parameters
xJitter value
Returns
Jitter between 0 ... x

Definition at line 46 of file random.h.