53 return (
unsigned short)rand();
65 unsigned short hwrng = 0;
66 NRF_RNG->TASKS_START = 1;
68 NRF_RNG->EVENTS_VALRDY = 0;
69 while(!NRF_RNG->EVENTS_VALRDY);
70 hwrng = (NRF_RNG->VALUE & 0xFF);
72 NRF_RNG->EVENTS_VALRDY = 0;
73 while(!NRF_RNG->EVENTS_VALRDY);
74 hwrng |= ((NRF_RNG->VALUE & 0xFF) << 8);
76 NRF_RNG->TASKS_STOP = 1;
void random_init(unsigned short seed)
Seed the cc2538 random number generator.
unsigned short random_rand(void)
Generates a new random number using the cc2538 RNG.