GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCBT / V1-1-0

Constituent: ssrsim     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

RND.h File Reference

Random Number Distributions, interface. More...

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Data Structures

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 _RND_lc0 RND_lc0
 Typedef for the struct _RND_lc0.

typedef _RND_normal_lc0 RND_normal_lc0
 Typedef for the struct _RND_normal0.

typedef _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

RND_lc0
 

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

RND_normal_lc0
 

Typedef for the struct _RND_normal0.

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

RND_poisson_lc0
 

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;

Here is the call graph for this function:

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

unsigned 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

Here is the call graph for this function:


Generated on Sat Oct 30 07:45:43 2004 by doxygen 1.3.3