61 return (
unsigned short)rand();
75 unsigned short hwrng = 0;
76 NRF_RNG->TASKS_START = 1;
78 NRF_RNG->EVENTS_VALRDY = 0;
79 while(!NRF_RNG->EVENTS_VALRDY);
80 hwrng = (NRF_RNG->VALUE & 0xFF);
82 NRF_RNG->EVENTS_VALRDY = 0;
83 while(!NRF_RNG->EVENTS_VALRDY);
84 hwrng |= ((NRF_RNG->VALUE & 0xFF) << 8);
86 NRF_RNG->TASKS_STOP = 1;
unsigned short random_rand(void)
Generates a new random number.
void random_init(unsigned short seed)
Initialize the random number generator.