Minimal Standard Random Numbers
[Random Numbers]

Collaboration diagram for Minimal Standard Random Numbers:


Files

file  msr.c
 Minimal Standard RANdom number generator.

Data Structures

struct  bn_unif
struct  bn_gauss

Defines

#define BN_UNIF_MAGIC   12481632
#define BN_GAUSS_MAGIC   512256128
#define BN_CK_UNIF(_p)   BU_CKMAG(_p, BN_UNIF_MAGIC, "bn_unif")
#define BN_CK_GAUSS(_p)   BU_CKMAG(_p, BN_GAUSS_MAGIC, "bn_gauss")
#define BN_UNIF_LONG(_p)
#define BN_UNIF_DOUBLE(_p)
#define BN_UNIF_CIRCLE(_p, _x, _y, _r)
#define BN_UNIF_SPHERE(_p, _x, _y, _z, _r)
#define BN_GAUSS_DOUBLE(_p)
#define BN_MSR_MAXTBL   4096
#define A   16807
#define M   2147483647
#define DM   2147483647.0
#define Q   127773
#define R   2836

Functions

bn_unifbn_unif_init (long setseed, int method)
void bn_unif_free (struct bn_unif *p)
long bn_unif_long_fill (struct bn_unif *p)
double bn_unif_double_fill (struct bn_unif *p)
bn_gaussbn_gauss_init (long setseed, int method)
void bn_gauss_free (struct bn_gauss *p)
double bn_gauss_fill (struct bn_gauss *p)
bn_unifbn_unif_init (long int setseed, int method)
bn_gaussbn_gauss_init (long int setseed, int method)

Define Documentation

#define BN_UNIF_MAGIC   12481632
 

Definition at line 562 of file bn.h.

Referenced by bn_unif_double_fill(), bn_unif_init(), bn_unif_long_fill(), and bu_identify_magic().

#define BN_GAUSS_MAGIC   512256128
 

Definition at line 563 of file bn.h.

Referenced by bn_gauss_init(), bn_unif_double_fill(), bn_unif_long_fill(), and bu_identify_magic().

#define BN_CK_UNIF _p   )     BU_CKMAG(_p, BN_UNIF_MAGIC, "bn_unif")
 

Definition at line 565 of file bn.h.

Referenced by bn_unif_double_fill(), and bn_unif_long_fill().

#define BN_CK_GAUSS _p   )     BU_CKMAG(_p, BN_GAUSS_MAGIC, "bn_gauss")
 

Definition at line 566 of file bn.h.

Referenced by bn_gauss_fill().

#define BN_UNIF_LONG _p   ) 
 

Value:

(((_p)->msr_long_ptr ) ? \
                (_p)->msr_longs[--(_p)->msr_long_ptr] : \
                bn_unif_long_fill(_p))

Definition at line 601 of file bn.h.

#define BN_UNIF_DOUBLE _p   ) 
 

Value:

(((_p)->msr_double_ptr) ? \
                (_p)->msr_doubles[--(_p)->msr_double_ptr] : \
                bn_unif_double_fill(_p))

Definition at line 605 of file bn.h.

#define BN_UNIF_CIRCLE _p,
_x,
_y,
_r   ) 
 

Value:

{ \
        do { \
                (_x) = 2.0*BN_UNIF_DOUBLE((_p)); \
                (_y) = 2.0*BN_UNIF_DOUBLE((_p)); \
                (_r) = (_x)*(_x)+(_y)*(_y); \
        } while ((_r) >= 1.0);  }

Definition at line 610 of file bn.h.

Referenced by bn_gauss_fill().

#define BN_UNIF_SPHERE _p,
_x,
_y,
_z,
_r   ) 
 

Value:

{ \
        do { \
                (_x) = 2.0*BN_UNIF_DOUBLE(_p); \
                (_y) = 2.0*BN_UNIF_DOUBLE(_p); \
                (_z) = 2.0*BN_UNIF_DOUBLE(_p); \
                (_r) = (_x)*(_x)+(_y)*(_y)+(_z)*(_z);\
        } while ((_r) >= 1.0) }

Definition at line 617 of file bn.h.

#define BN_GAUSS_DOUBLE _p   ) 
 

Value:

(((_p)->msr_gauss_ptr) ? \
                (_p)->msr_gausses[--(_p)->msr_gauss_ptr] : \
                bn_gauss_fill(_p))

Definition at line 625 of file bn.h.

#define BN_MSR_MAXTBL   4096
 

Note: BN_MSR_MAXTBL must be an even number.

Definition at line 61 of file msr.c.

Referenced by bn_gauss_fill(), bn_gauss_init(), bn_unif_double_fill(), bn_unif_init(), and bn_unif_long_fill().

#define A   16807
 

Definition at line 89 of file msr.c.

Referenced by bend_pipe_shot(), bn_mat_ck(), bn_mat_fromto(), bn_poly_cubic_roots(), bn_unif_double_fill(), bn_unif_long_fill(), db_non_union_push(), do_intersect(), do_subtract(), do_union(), eval_etree(), eval_op(), rt_ehy_plot(), rt_ehy_tess(), rt_epa_plot(), rt_epa_tess(), rt_mk_hyperbola(), rt_tgc_tess(), rt_tor_shot(), and rt_tor_vshot().

#define M   2147483647
 

Definition at line 90 of file msr.c.

Referenced by bn_mat_fromto(), bn_unif_double_fill(), bn_unif_long_fill(), db_functree(), rt_comb_export4(), rt_nurb_curvature(), and rt_tgc_curve().

#define DM   2147483647.0
 

Definition at line 91 of file msr.c.

Referenced by bn_unif_double_fill().

#define Q   127773
 

Definition at line 92 of file msr.c.

Referenced by bn_mat_fromto(), bn_unif_double_fill(), and bn_unif_long_fill().

#define R   2836
 

Definition at line 93 of file msr.c.

Referenced by bn_mat_fromto(), bn_unif_double_fill(), bn_unif_long_fill(), rt_bend_pipe_prep(), rt_ehy_plot(), rt_ehy_prep(), rt_ehy_tess(), rt_ell_prep(), rt_ell_tess(), rt_ell_tnurb(), rt_epa_plot(), rt_epa_prep(), rt_epa_tess(), rt_linear_pipe_prep(), rt_part_prep(), rt_part_tess(), rt_rec_prep(), rt_rhc_plot(), rt_rhc_prep(), rt_rhc_tess(), rt_rpc_plot(), rt_rpc_prep(), rt_rpc_tess(), rt_superell_prep(), rt_tgc_curve(), rt_tgc_norm(), rt_tgc_shot(), rt_tgc_vshot(), and rt_tor_prep().


Function Documentation

struct bn_unif* bn_unif_init long  setseed,
int  method
 

void bn_unif_free struct bn_unif p  ) 
 

Definition at line 239 of file msr.c.

References bu_free(), bn_unif::magic, bn_unif::msr_doubles, and bn_unif::msr_longs.

Here is the call graph for this function:

long bn_unif_long_fill struct bn_unif p  ) 
 

Definition at line 139 of file msr.c.

References A, BN_CK_UNIF, BN_GAUSS_MAGIC, BN_MSR_MAXTBL, BN_UNIF_MAGIC, M, bn_unif::magic, bn_unif::msr_long_ptr, bn_unif::msr_longs, bn_unif::msr_seed, Q, and R.

double bn_unif_double_fill struct bn_unif p  ) 
 

Definition at line 201 of file msr.c.

References A, BN_CK_UNIF, BN_GAUSS_MAGIC, BN_MSR_MAXTBL, BN_UNIF_MAGIC, DM, M, bn_unif::magic, bn_unif::msr_double_ptr, bn_unif::msr_doubles, bn_unif::msr_seed, Q, and R.

struct bn_gauss* bn_gauss_init long  setseed,
int  method
 

void bn_gauss_free struct bn_gauss p  ) 
 

Definition at line 348 of file msr.c.

References bu_free(), bn_gauss::msr_gauss_doubles, and bn_gauss::msr_gausses.

Here is the call graph for this function:

double bn_gauss_fill struct bn_gauss p  ) 
 

Definition at line 320 of file msr.c.

References BN_CK_GAUSS, BN_MSR_MAXTBL, BN_UNIF_CIRCLE, bn_gauss::msr_gauss_ptr, and bn_gauss::msr_gausses.

struct bn_unif* bn_unif_init long int  setseed,
int  method
 

Definition at line 95 of file msr.c.

References BN_MSR_MAXTBL, BN_UNIF_MAGIC, bu_malloc(), bn_unif::magic, bn_unif::msr_double_ptr, bn_unif::msr_doubles, bn_unif::msr_long_ptr, bn_unif::msr_longs, and bn_unif::msr_seed.

Here is the call graph for this function:

struct bn_gauss* bn_gauss_init long int  setseed,
int  method
 

Definition at line 273 of file msr.c.

References BN_GAUSS_MAGIC, BN_MSR_MAXTBL, bu_malloc(), bn_gauss::magic, bn_gauss::msr_gauss_dbl_ptr, bn_gauss::msr_gauss_doubles, bn_gauss::msr_gauss_ptr, bn_gauss::msr_gauss_seed, and bn_gauss::msr_gausses.

Here is the call graph for this function:


Generated on Mon Sep 18 01:25:24 2006 for BRL-CAD by  doxygen 1.4.6