Developing with ZBOSS SDK for Zigbee
Random numbers generator

Macros

#define ZB_RAND_MAX   ((zb_uint16_t)0xffff)
 
#define ZB_RANDOM_VALUE(max_value)   (((zb_uint16_t)(max_value)) ? (zb_random() / (ZB_RAND_MAX / (zb_uint16_t)(max_value))) : 0)
 

Functions

zb_uint16_t zb_random (void)
 
void zb_bzero_volatile (volatile void *s, zb_uint_t size)
 

Detailed Description

Macro Definition Documentation

◆ ZB_RAND_MAX

#define ZB_RAND_MAX   ((zb_uint16_t)0xffff)

Maximal possible value for randomly generated (16-bit) value

◆ ZB_RANDOM_VALUE

#define ZB_RANDOM_VALUE (   max_value)    (((zb_uint16_t)(max_value)) ? (zb_random() / (ZB_RAND_MAX / (zb_uint16_t)(max_value))) : 0)

Generate random value between 0 to max_value (16 bit)

Function Documentation

◆ zb_bzero_volatile()

void zb_bzero_volatile ( volatile void *  s,
zb_uint_t  size 
)

Analogue of bzero() for volatile data.

A custom version should be implemented because there is no standard library function for that purpose. Also, this function is not platform-dependent in contrast to ZB_BZERO() macro and therefore can't be overriden by specific ZBOSS platform.

The function sets individually every byte of provided memory region to zero.

◆ zb_random()

zb_uint16_t zb_random ( void  )

Generate random value

Returns
random value between 0 to 0xffff (16 bit)