FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
random.c File Reference

Random number support. More...

+ Include dependency graph for random.c:

Go to the source code of this file.

Functions

f64 clib_chisquare (u64 *values)
 Compute the X2 test statistic for a vector of counts. More...
 

Variables

u32 standalone_random_default_seed = 1
 Default random seed for standalone version of library. More...
 

Detailed Description

Random number support.

Definition in file random.c.

Function Documentation

◆ clib_chisquare()

f64 clib_chisquare ( u64 values)

Compute the X2 test statistic for a vector of counts.

Each value element corresponds to a histogram bucket.

Typical use-case: test the hypothesis that a set of octets are uniformly distributed (aka random).

In a 1-dimensional use-case, the result should be compared with the critical value from chi square tables with vec_len(values) - 1 degrees of freedom.

Parameters
[in]valuesvector of histogram bucket values
Returns
d - Pearson's X2 test statistic

Definition at line 65 of file random.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ standalone_random_default_seed

u32 standalone_random_default_seed = 1

Default random seed for standalone version of library.

Value can be overridden by platform code from e.g. machine's clock count register.

Definition at line 47 of file random.c.