#ifndef	_TB_RAND_H
#define	_TB_RAND_H

#ifndef	_TB_DEFS_H
#	include	"tb_defs.h"
#endif

typedef struct
{
	unsigned int	n;
	POINT		   *tbl;
} POINTRNDTBL;

typedef struct
{
	unsigned int		n;
	unsigned int	   *tbl;
} COLORRNDTBL;

extern POINTRNDTBL	PointRnd;
extern COLORRNDTBL	ColorRnd;


#define	GETRNDCOL(_c,_max)	(ColorRnd.tbl[(_c) & (ColorRnd.n-1)] & (_max))
#define	GETRNDPX(_c)		(PointRnd.tbl[(_c) & (PointRnd.n-1)].x)
#define	GETRNDPY(_c)		(PointRnd.tbl[(_c) & (PointRnd.n-1)].y)

extern int		tb_init_pointRndTbl(void);
extern void		tb_term_pointRndTbl(void);
extern int		tb_init_colorRndTbl(void);
extern void		tb_term_colorRndTbl(void);

extern void				tb_srand( unsigned int seed );
extern unsigned int		tb_rand(void);

#endif
