/****************************************************************************/
/*****************************************************************************
 *                      
 *      Project:        16x training
 *      Name:           random generator 
 *      Filename:       random.c
 *      System:         IBM PC/AT
 *      Compiler:       c166 V3.11
 *      Date:           02/98
 *      Author:         Siegbert Schaufelberger
 *      Rights:         hitex-systementwicklung GmbH        
 *                      Greschbachstr. 12
 *                      76229  Karlsruhe
 *                                                         
 *****************************************************************************
 *
 *      Implementation description:
 *
 *
 *****************************************************************************
 *
 *      Update:
 *        Date /Sgn.       Version  Changes made because of ...
 *      __-___-____/
 *
 *
 ****************************************************************************/
/****************************************************************************/


/****************************************************************************/
/***					System includes			                          ***/
/****************************************************************************/
#include <intrins.h>

/****************************************************************************/
/***					Defines & Constants                               ***/
/****************************************************************************/

#define INI 0 	   
#define INC 2073	
#define MUL 421 	


/****************************************************************************/
/***					Externals					                      ***/
/****************************************************************************/
          
                    
/****************************************************************************/
/***					Publics						                      ***/
/****************************************************************************/


/****************************************************************************/
/***					Functions					                      ***/
/****************************************************************************/

/*----------------------------------------------------------------------------
 *      
 *  Name:          random 
 *      
 *  Description:   calculate a random value between 0 and 9 
 *                  
 *      
 *  Parameters:     
 *                  
 *                  
 *  Return Value:   r =0-9
 *                  
 *--------------------------------------------------------------------------*/

unsigned int random ()
{
	static unsigned long random_tmp = INI;
	random_tmp *= MUL;
	random_tmp += INC;

	return ((unsigned int)(random_tmp %10));
}

