X-Git-Url: http://olsr.org/git/?p=olsrd.git;a=blobdiff_plain;f=lib%2Fpud%2Fnmealib%2Fsrc%2Fgenerator.c;h=26edd3a29340ee2cbdd6a203df375ed4df5758ee;hp=c9c5aaca8ccb79bb64413640f03fad7c74a93744;hb=dd1b96e40d0374d23d0156776b41f8df55a7c860;hpb=12d6845a0a7499517a75daf3a09d343a92b1a22c diff --git a/lib/pud/nmealib/src/generator.c b/lib/pud/nmealib/src/generator.c index c9c5aaca..26edd3a2 100644 --- a/lib/pud/nmealib/src/generator.c +++ b/lib/pud/nmealib/src/generator.c @@ -21,24 +21,12 @@ #include #include +#include "random.h" + #include #include #include -/** - * Generate a random number in the range [min, max] - * - * @param min the minimum - * @param max the maximum - * @return a random number - */ -static double nmea_random(const double min, const double max) { - static double rand_max = RAND_MAX; - double rand_val = rand(); - double bounds = max - min; - return min + (rand_val * bounds) / rand_max; -} - /** * Initialise the generator * @@ -53,6 +41,8 @@ int nmea_gen_init(nmeaGENERATOR *gen, nmeaINFO *info) { int smask = info->smask; nmeaGENERATOR *igen = gen; + nmea_init_random(); + nmea_zero_INFO(info); info->present = present; info->smask = smask;