Collaboration diagram for Random Number Tables:
![]() |
Files | |
file | rand.c |
These are our tables of random numbers. | |
Defines | |
#define | BN_RAND_TABSIZE 4096 |
#define | BN_RAND_TABMASK 0xfff |
#define | BN_RANDSEED(_i, _seed) _i = ((unsigned)_seed) % BN_RAND_TABSIZE |
#define | BN_RANDOM(_i) bn_rand_table[ _i = (_i+1) % BN_RAND_TABSIZE ] |
#define | BN_RANDHALF(_i) (bn_rand_table[ _i = (_i+1) % BN_RAND_TABSIZE ]-0.5) |
#define | BN_RANDHALF_INIT(_p) _p = bn_rand_table |
#define | BN_RANDHALFTABSIZE 16535 |
#define | bn_rand_half(_p) |
#define | bn_rand_init(_p, _seed) |
#define | bn_rand0to1(_q) (bn_rand_half(_q)+0.5) |
#define | BN_SINTABSIZE 2048 |
#define | bn_tab_sin(_a) |
Functions | |
void | bn_mathtab_constant (void) |
For benchmarking purposes, make the random number table predictable. Setting to all zeros keeps dithered values at their original values. | |
Variables | |
const float | bn_rand_table [BN_RAND_TABSIZE] |
int | bn_randhalftabsize |
float | bn_rand_halftab [BN_RANDHALFTABSIZE] |
double | bn_sin_scale |
SINTABSIZE / TWOPI. | |
const float | bn_sin_table [BN_SINTABSIZE] |
table of sine values. | |
const float | bn_rand_table [BN_RAND_TABSIZE] |
double | bn_sin_scale = 325.949323452232 |
SINTABSIZE / TWOPI. | |
const float | bn_sin_table [BN_SINTABSIZE] |
table of sine values. | |
int | bn_randhalftabsize = BN_RANDHALFTABSIZE |
float | bn_rand_halftab [BN_RANDHALFTABSIZE] |
float | bn_rand_poison_ [] |
|
Definition at line 1018 of file bn.h. Referenced by bn_noise_init(). |
|
|
|
Definition at line 1020 of file bn.h. Referenced by bn_noise_init(). |
|
BN_RANDOM always gives numbers between 0.0 and 1.0 Definition at line 1024 of file bn.h. Referenced by bn_cmd_random(), and bn_noise_init(). |
|
BN_RANDHALF always gives numbers between -0.5 and 0.5 |
|
|
|
|
|
Value: ( (++(_p) >= &bn_rand_halftab[bn_randhalftabsize] || \ (_p) < bn_rand_halftab) ? \ *((_p) = bn_rand_halftab) : *(_p)) |
|
Value: (_p) = &bn_rand_halftab[ \ (int)( \ (bn_rand_halftab[(_seed)%bn_randhalftabsize] + 0.5) * \ (bn_randhalftabsize-1)) ] |
|
random numbers 0..1 except when benchmarking, when this is always 0.5 |
|
|
|
Value: (((_a) > 0) ? \ ( bn_sin_table[(int)((0.5+ (_a)*bn_sin_scale))&(BN_SINTABSIZE-1)] ) :\ (-bn_sin_table[(int)((0.5- (_a)*bn_sin_scale))&(BN_SINTABSIZE-1)] )) |
|
For benchmarking purposes, make the random number table predictable. Setting to all zeros keeps dithered values at their original values. M A T H T A B _ C O N S T A N T Definition at line 3646 of file rand.c. References bn_rand_halftab. |
|
This is our table of random numbers. Rather than calling drand48() or random() or rand() we just pick numbers out of this table. This table has 4096 unique entries. Macros for accessing are in "bn.h" |
|
|
|
The actual table of random numbers, range -0.5 to +0.5 For benchmarking purposes, this table is zeroed. Definition at line 1261 of file rand.c. Referenced by bn_mathtab_constant(). |
|
SINTABSIZE / TWOPI.
|
|
table of sine values. from rt/mathtab.c |
|
This is our table of random numbers. Rather than calling drand48() or random() or rand() we just pick numbers out of this table. This table has 4096 unique entries. Macros for accessing are in "bn.h" |
|
SINTABSIZE / TWOPI.
|
|
table of sine values. from rt/mathtab.c |
|
|
|
The actual table of random numbers, range -0.5 to +0.5 For benchmarking purposes, this table is zeroed. Definition at line 1261 of file rand.c. Referenced by bn_mathtab_constant(). |
|
Initial value: { 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f, 9e20f } |