BRL-CAD
rand.h File Reference
#include "common.h"
#include "bn/defines.h"
Include dependency graph for rand.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BN_RAND_TABSIZE   4096
 A supply of fast pseudo-random numbers from table in bn/rand.c. The values are in the open interval (i.e. exclusive) of 0.0 to 1.0 range with a period of 4096. More...
 
#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 /* Powers of two give streaking */
 
#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. More...
 

Variables

const float bn_rand_table [BN_RAND_TABSIZE]
 
int bn_randhalftabsize
 
float bn_rand_halftab [BN_RANDHALFTABSIZE]
 
const float bn_sin_table [BN_SINTABSIZE]