GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCBT / V1-4-2

Constituent: ssrsim     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

RND.c File Reference

Random Number Distributions, interface. More...

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

Include dependency graph for RND.c:

Include dependency graph

Functions

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;

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

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 Wed Mar 9 21:26:31 2005 by doxygen 1.3.3