1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #3440 from authmillenon/random/feat/range

random: provide range functionality
This commit is contained in:
Martine Lenders 2015-07-18 17:37:59 +02:00
commit 2b5a9049f4

View File

@ -54,6 +54,20 @@ void genrand_init_by_array(uint32_t init_key[], int key_length);
*/
uint32_t genrand_uint32(void);
/**
* @brief generates a random number r with a < r <= b.
*
* @param[in] a minimum for random number
* @param[in] b upper bound for random number
*
* @pre a < b
*
* @return a random number on [a,b)-interval
*/
static inline uint32_t genrand_uint32_range(uint32_t a, uint32_t b)
{
return (genrand_uint32() % (b - a)) + a;
}
#if PRNG_FLOAT
/* These real versions are due to Isaku Wada, 2002/01/09 added */