embeddedlibrary
reusable software modules for embedded systems
Generate random integer in a given range

Functions

int random_int (int16_t min_num, int16_t max_num)
 

Detailed Description

Created on: Mar 14, 2014 Author: Muhlbaier

Function Documentation

int random_int ( int16_t  min_num,
int16_t  max_num 
)

Generate a random integer

Generates a pseudo random value between min_num and max_num.

Based on rand() and srand().

Note: srand will be called on the first call of this function. Thus the time to run will be significantly longer on the first call.

Parameters
min_nummin value to generate
max_nummax value to generate
Returns