#ifndef	RGCACHE_H
#define	RGCACHE_H

#include <v_lib.h>

#define	RGCACHE_SIZE	1024;

typedef struct rgcache_s
{
	vboolean own_rg;
	vhandle_t rg;
	vec_t	min, max;
	vec_t	mean, stdev;
	u32_t	g_idx;
	u32_t	u_idx;
	vector_p	g_cache;
	vector_p	u_cache;
} rgcache_t, *rgcache_p;

extern s32_t global_rgc_seed;

rgcache_p V_GLOBAL
rgcCreate(u32_t cache_size, /* can be 0 */
	vhandle_t rg, /* can be NULL */
	vec_t min, vec_t max, /* for uniforms */
	vec_t mean, vec_t stdev /* for gaussians */);

rgcache_p	V_GLOBAL
rgcReset(rgcache_p rgc,
	vec_t min, vec_t max, /* for uniforms */
	vec_t mean, vec_t stdev /* for gaussians */);

void	V_GLOBAL	rgcDestroy(rgcache_p rgc);
vec_t	V_GLOBAL	rgcNext(rgcache_p rgc);
vec_t	V_GLOBAL	rgcNextGaussian(rgcache_p rgc);

#endif	/* RGCACHE_H */
