GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCBT / V1-6-2 > ssrsim / rhel5-32


Interface   Data Structures   File List   Data Fields   Globals  

RND.h File Reference

Random Number Distributions, interface. More...


Classes

struct  _RND_lc0
 Structure giving the parameters of a simply linear congruent random number generator. More...
struct  _RND_normal_lc0
 Structure giving the parameters of a simple normal distribution random number generator. More...
struct  _RND_poisson_lc0
 Structure giving the parameters of a poisson distribution. More...

Typedefs

typedef struct _RND_lc0 RND_lc0
 Typedef for the struct _RND_lc0.
typedef struct _RND_normal_lc0 RND_normal_lc0
 Typedef for the struct _RND_normal0.
typedef struct _RND_poisson_lc0 RND_poisson_lc0
 Typedef for the struct _LSI_poisson_lco.

Functions

void RND_lc0_init (RND_lc0 *ctx, unsigned int seed)
 Init.
unsigned int RND_lc0_gen (RND_lc0 *ctx)
 Produces a random number in the range 0 - 2**32-1 using a linear congruent method.
int RND_normal_lc0_gen (RND_normal_lc0 *ctx)
 Produces a normal distribution.


Detailed Description

Random Number Distributions, interface.

Author:
JJRussell - russell@slac.stanford.edu

    CVS $Id: RND.h,v 1.1 2004/07/19 20:04:00 ebacho Exp $

SYNOPSIS
Defines the interfaces for a number of common random number distributions.
The casual reader may well ask why provide these here when such objects are readily available on most platforms. The answer is that the algorithms generating these distributions are fully exposed so that they may be readily implemented on a more than one platforms. This means, that given the algorithm and its parameterization, the exact distribution may be generated on any machine. This is valuable when. for example, one generates test patterns using these algorithms and ships the results to another machine for comparison. If the algorithm and its parameterization are stored, the remote machine can exactly reproduce and check the distribution.

Typedef Documentation

Typedef for the struct _RND_lc0.

This random number generator uses the formula

x_{n+1} = (a x_n + c)

Suggested choices are

  • a = 69069
  • c = 1

The seed value must be odd. It has been selected since it is relatively fast, involving only a multiply and an addition. Probably not a great choice for real math, but for generating random patterns, not bad

Typedef for the struct _RND_normal0.

This is a very simplistic generator, just adding 6 random numbers from the LC generator

Typedef for the struct _LSI_poisson_lco.

This is just a scaled exponential distribution, using a linear congruent


Function Documentation

unsigned int RND_lc0_gen ( RND_lc0 ctx  ) 

Produces a random number in the range 0 - 2**32-1 using a linear congruent method.

Returns:
A random number in the range 0 - 2**32 - 1
Parameters:
ctx Context parameter
One should scale this number by a suitable factor to produce the desired distribution. No should not use a modulus function. For example, do not do

      r = RND__lc0_args (...) % 256;

To produce a number from 0 - 255. Rather do

     r = RND__lco_args (...) >> 24;

References _RND_lc0::a, _RND_lc0::c, RND__lc0_args(), and _RND_lc0::seed.

void RND_lc0_init ( RND_lc0 ctx,
unsigned int  seed 
)

Init.

Returns:
Init random number struct to suggested values
Parameters:
ctx Context parameter
seed random number seed

References _RND_lc0::a, _RND_lc0::c, and _RND_lc0::seed.

Referenced by SSRSIM_init().

int RND_normal_lc0_gen ( RND_normal_lc0 ctx  ) 

Produces a normal distribution.

Returns:
A random number drawn from a normal distribution
Parameters:
ctx Context parameter

References _RND_lc0::a, _RND_lc0::c, _RND_normal_lc0::lc0, _RND_normal_lc0::mean, RND__lc0_args(), _RND_lc0::seed, and _RND_normal_lc0::sigma.


Generated on Fri Mar 25 12:46:16 2011 by  doxygen 1.5.8