libtpcmodel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Defines | Functions
gaussdev.c File Reference
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "include/gaussdev.h"
Include dependency graph for gaussdev.c:

Go to the source code of this file.

Defines

#define RAND_MAX   32767
#define RS_SCALE   (1.0 / (1.0 + RAND_MAX))

Functions

double gaussdev ()
void init_gaussdev ()
double drand ()
int rand_range (int nr, double *d, double low, double up, int type)

Define Documentation

#define RAND_MAX   32767

Definition at line 42 of file gaussdev.c.

#define RS_SCALE   (1.0 / (1.0 + RAND_MAX))

Definition at line 44 of file gaussdev.c.

Referenced by drand().


Function Documentation

double drand ( )

Alternative function to rand() which returns a double precision floating point number in the range of [0,1].

Returns:
Random value in the range [0,1].

Definition at line 93 of file gaussdev.c.

References RS_SCALE.

Referenced by gaussdev(), rand_range(), tgoRandomParameters(), and tgoRandomParametersST().

double gaussdev ( )

Definition at line 55 of file gaussdev.c.

References drand(), and init_gaussdev().

Referenced by pivot_lep().

Here is the call graph for this function:

void init_gaussdev ( )

Definition at line 83 of file gaussdev.c.

References GAUSSDEV_SEED.

Referenced by gaussdev().

int rand_range ( int  nr,
double *  d,
double  low,
double  up,
int  type 
)

Fills the double array with random numbers between specified limits. Set seed for random number generator before calling this routine, for example with srand(time(NULL));

Returns:
Returns 0 when successful, otherwise <> 0.
Parameters:
nrNr of values in double array
dPointer to allocated double array
lowLower limit for random values
upUpper limit for random values
typeDistribution: 0=even, 1=square-root transformation

Definition at line 109 of file gaussdev.c.

References drand().

Here is the call graph for this function: