/******************************  rantab.c  **********************************

  Purpose:	Routines for handling the random number tables.

  Provenance:	Written and tested by Q. Chen and E. Fox, March 1991.
  		Edited and tested by S. Wartik, April 1991.

  Notes:	None.

**/


#include "types.h"
#include "pmrandom.h"
#include "rantab.h"

/*************************************************************************

	initialize_randomTable( randomTablesType, int )

  Return:	void
  
  Purpose:	Initialize the three random number tables and return the seed
		used.
**/

void initialize_randomTable( tables, seed )
    randomTablesType tables;	/* out: Tables of random numbers.	*/
    int		     *seed;	/* out: seed used to initialize tables. */
{
    int i, j, k;		  /* Iterators over the tables.		*/

    *seed = getseed();
    setseed( *seed );

    for ( i = 0; i < NO_TABLES; i++ )	      /* Initialize the tables. */
	for ( j = 0; j < ROWS; j++ )
	    for ( k = 0; k < COLUMNS; k++ )
		tables[i][j][k] = pmrandom();
}
