Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

random.h File Reference

Definition of basic randomization functions. More...

#include "interval.h"

Go to the source code of this file.

Functions

void randomReset ()
 Resets the random seed.
void randomSet (unsigned int seed)
 Sets the random seed.
double randomDouble ()
 Returns a random double in the [0,1] interval.
double randomInInterval (Tinterval *t)
 Returns a random double in the given interval.
unsigned int randomMax (unsigned int m)
 Returns a random integer in the range [0,m].

Detailed Description

Definition of basic randomization functions.

See also:
random.c.

Definition in file random.h.


Function Documentation

void randomReset (  ) 

Resets the random seed using the current time so, in principle, the reset is hard to predict.

Definition at line 18 of file random.c.

Referenced by main().

Here is the caller graph for this function:

void randomSet ( unsigned int  seed  ) 

Sets the random to the given value. This is used to get repetitive sequences of random numbers in order to debug mainly.

Parameters:
seed The new random seed.

Definition at line 23 of file random.c.

double randomDouble (  ) 

Returns a random number in the [0,1] interval selected with a uniform distribution.

Returns:
A random double in [0,1].

Definition at line 28 of file random.c.

Referenced by randomInInterval(), randomMax(), and SimplexAddNewConstraint().

Here is the caller graph for this function:

double randomInInterval ( Tinterval t  ) 

Returns a random number in the given interval selected with a uniform distribution.

Parameters:
t The interval where to drawn the random sample.
Returns:
A random double in the given interval.

Definition at line 33 of file random.c.

References LowerLimit(), randomDouble(), and UpperLimit().

Referenced by SampleCuikSystemInBox().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int randomMax ( unsigned int  m  ) 

Returns a random integer in the range [0,m] selected with a uniform distribution. Observe that m is included as a possible outcome.

Parameters:
m The upper limit for the random generator.
Returns:
The randomly selected integer in [0,m].

Definition at line 43 of file random.c.

References randomDouble().

Referenced by ComputeSplitDimInt().

Here is the call graph for this function:

Here is the caller graph for this function: