ECE 658: Performance Evaluation and Simulation
Electrical and Computer Engineering,
University of Cyprus
ECE Home Contact Us
 
 
Programming Assignment 3
 
  Due: Thursday, November 2, 2006
Objective: Experiment with random number generators.
  • Write a program that generates N random variates (N is an input to your program) uniformly distributed in the interval (0,1). Use the Chi-Square test to test if the generated data fit the distribution. You can use the following uniform random number generator.
Input:
  1. Number of samples N.
  2. Number of intervals for the purposes of the Chi-Square test.
Output:
  1. Number of samples in each interval
  2. The value of the statistic (sum of errors).
Report:
  1. Perform the test for the 5 initial seeds shown below as well as for various values of N and present your results in an appropriate way.
  2. Estimate the covariance between each random variate with its previous variate.
  3. Estimate the covariance between each generated random variate with the one before its previous.
Seeds:
  • 1397, 2171, 5171, 7147, 9913
RNG:

ISEED[5]={1397, 2171, 5171, 7147, 9913};

double UNI(int seed) /*Generate a random number uniformly distributed in [0,1].*/
{
   long a= ISEED[seed]/16384;
   long b= ISEED[seed]%16384;
   ISEED[seed]= (((13205*a+74505*b)%16384)*16384+13205*b)%268435456;
   return ((double)(ISEED[seed]/268435456.0));
}/*UNI()*/

   
  last updated September 27, 2006