/* Generates a 16-bit random number used as initial seed for srand() 
Also in case the function is called from a different state than TRX_OFF, additional trx state handling is required, such as reading the original value and restoring this state after finishing the sequence. Since in our case the function is called from TRX_OFF, this is not required here.  */
static void generate_rand_seed(void)
/* Generates a 16-bit random number used as initial seed for srand() 
Also in case the function is called from a different state than TRX_OFF, additional trx state handling is required, such as reading the original value and restoring this state after finishing the sequence. Since in our case the function is called from TRX_OFF, this is not required here.  */
static void generate_rand_seed(void)
{
	uint16_t seed = 0;
	uint8_t cur_random_val = 0;
	set_trx_state(CMD_RX_ON);
	ENTER_TRX_REGION();
	for (uint8_t i = 0; i < 8; i++) {
		cur_random_val = pal_trx_bit_read(SR_RND_VALUE);
		seed = seed << 2;
		seed |= cur_random_val;
	}
	set_trx_state(CMD_TRX_OFF);
	pal_trx_reg_read(RG_IRQ_STATUS);
	CLEAR_TRX_IRQ();
	LEAVE_TRX_REGION();
	srand(seed);
}