Paparazzi UAS  v5.17_devel-24-g2ae834f
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pprz_random.c File Reference
#include "pprz_random.h"
#include <time.h>
+ Include dependency graph for pprz_random.c:

Go to the source code of this file.

Functions

void init_random (void)
 
double rand_uniform (void)
 
double rand_gaussian (void)
 

Detailed Description

Author
Joost Meulenbeld Random number functions
Joost Meulenbeld

Functions for getting random numbers. The rand_gaussian() internally uses the rand_uniform(). rand_uniform() uses rand() internally which is initialized with the current time on rand_init(). This means that the board doesn't need an internal rng but comes at the cost of more computations.

Usage: rand_init(); // initialize once

float random_number = rand_uniform();

Definition in file pprz_random.c.

Function Documentation

void init_random ( void  )

Definition at line 35 of file pprz_random.c.

References get_sys_time_msec().

Referenced by sys_id_chirp_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double rand_gaussian ( void  )

Definition at line 53 of file pprz_random.c.

References rand_uniform().

Referenced by set_current_chirp_values().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double rand_uniform ( void  )

Definition at line 45 of file pprz_random.c.

Referenced by rand_gaussian().

+ Here is the caller graph for this function: