# rng.c File Reference

Uniform and Normal RNG Implemented in OpenMP. More...

`#include <stdlib.h>`
`#include <stdio.h>`
`#include <math.h>`
`#include <sys/time.h>`
`#include <omp.h>`
`#include <limits.h>`

## Defines
#define | PI acos(-1)
## Functions
double | randu (int *seed, int index)
double | randn (int *seed, int index)
int | main ()
## Variables
long | M = INT_MAX
int | A = 1103515245
int | C = 12345

## Detailed Description

Uniform and Normal RNG Implemented in OpenMP.

Author:
  Michael Trotter & Matt Goodrum

## Function Documentation

int main | ( |  | ) |

A simple main that demonstrates how to setup the seed array for use

double randn | ( | int * | seed,
|  | int | index |
| ) |  |  |

Generates a normally distributed random number using the Box-Muller transformation

Note:
  This function is thread-safe

Parameters:

  | seed | The seed array
  | index | The specific index of the seed to be advanced

Returns:
  a double representing random number generated using the Box-Muller algorithm

See also:
  http://en.wikipedia.org/wiki/Normal_distribution, section computing value for normal random distribution

double randu | ( | int * | seed,
|  | int | index |
| ) |  |  |

Generates a uniformly distributed random number using the provided seed and GCC's settings for the Linear Congruential Generator (LCG)

See also:
  http://en.wikipedia.org/wiki/Linear_congruential_generator

Note:
  This function is thread-safe

Parameters:

  | seed | The seed array
  | index | The specific index of the seed to be advanced

Returns:
  a uniformly distributed number [0, 1)

All Files Functions