MathUtilities 1.1.15
Common math functions shared across compiled apps at NML-NHP.
Loading...
Searching...
No Matches
Random

Functions related to random number generation. More...

Functions

void generateRandomControlTimes (double *controlTimes, const size_t numPoints)
 Generate random control times for cubic spline interpolation.
 
void generateRandomControlPoints (double *controlPoints, const double maxValue, const size_t numPoints)
 Generate random control points for cubic spline interpolation.
 
int random_int (int min, int max)
 Generate a random integer between min and max (inclusive).
 
double randomExponentialSeconds (double minSeconds, double maxSeconds)
 Generate a random floating point value (seconds) between a minimum and maximum value.
 
void shuffle (int arr[], int n)
 Shuffles the elements of an array.
 

Detailed Description

Functions related to random number generation.

Function Documentation

◆ generateRandomControlPoints()

void generateRandomControlPoints ( double * controlPoints,
const double maxValue,
const size_t numPoints )

Generate random control points for cubic spline interpolation.

Parameters
controlPointsPointer to an array to store the generated control points.
maxValueThe maximum value for generating random control points.
numPointsThe number of control points.

◆ generateRandomControlTimes()

void generateRandomControlTimes ( double * controlTimes,
const size_t numPoints )

Generate random control times for cubic spline interpolation.

Parameters
controlTimesPointer to an array to store the generated control times.
numPointsThe number of control points.

◆ random_int()

int random_int ( int min,
int max )

Generate a random integer between min and max (inclusive).

Parameters
minThe minimum value for the random integer (inclusive).
maxThe maximum value for the random integer (inclusive).
Returns
The generated random integer.

◆ randomExponentialSeconds()

double randomExponentialSeconds ( double minSeconds,
double maxSeconds )

Generate a random floating point value (seconds) between a minimum and maximum value.

If the maximum is less than or equal to the minimum, returns the minimum value. Otherwise, computes an exponential distribution between the minimum and maximum values.

Parameters
minSecondsThe minimum value in seconds.
maxSecondsThe maximum value in seconds.
Returns
A random floating point value in seconds.

◆ shuffle()

void shuffle ( int arr[],
int n )

Shuffles the elements of an array.

This function shuffles the elements of the given array in place. It uses the Fisher-Yates shuffle algorithm.

Parameters
arrThe array to be shuffled.
nThe number of elements in the array.