The Cuik KD-Tree Library


random.c File Reference

Implementation of the basic randomization functions. More...

#include "random.h"
#include <sys/types.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>
Include dependency graph for random.c:

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 randomNormal ()
 Returns a random double acording to a normal distribution.

Detailed Description

Implementation of the basic randomization functions.

See also:
random.h.

Definition in file random.c.


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.

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 25 of file random.c.

Referenced by main().

Here is the caller graph for this function:

double randomDouble (  )  [inline]

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

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

Definition at line 33 of file random.c.

Referenced by randomNormal(), RandomPointInRectangle(), and SampleInKDtree().

Here is the caller graph for this function:

double randomNormal (  ) 

Returns a random number following a normal distribution with mean 0 and standard deviation 1.

Returns:
A random double.

Definition at line 38 of file random.c.

References randomDouble().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function: