Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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

◆ init_random()

void init_random ( void  )

Definition at line 35 of file pprz_random.c.

References get_sys_time_msec(), and time.

Referenced by actuators_uavcan_init(), power_uavcan_init(), and sys_id_chirp_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rand_gaussian()

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:

◆ rand_uniform()

double rand_uniform ( void  )

Definition at line 45 of file pprz_random.c.

Referenced by actuators_uavcan_next_telem(), imu_heater_periodic(), power_uavcan_send_power_device(), and rand_gaussian().

+ Here is the caller graph for this function: