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


Interface   Data Structures   File List   Data Fields   Globals  

RND.c File Reference

Random Number Distributions, interface. More...

#include <RND.h>
#include <math.h>

Functions

static unsigned int RND__lc0_args (unsigned int prv, unsigned int a, unsigned int c)
 Produces a random number in the range 0 - 2**32-1 using a linear congruent method.
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

Function Documentation

unsigned int RND__lc0_args ( unsigned int  prv,
unsigned int  a,
unsigned int  c 
) [inline, static]

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:
prv The previous random number
a The multiplier
c The additive factor
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;

Referenced by RND_lc0_gen(), and RND_normal_lc0_gen().

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().

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

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:15 2011 by  doxygen 1.5.8