Exercise 2
Consider a generator to obtain uniform random numbers xi according to
k = ki ^ ( ki << q ) ,
ki+1 = k ^ ( k >> p ) ,
with p = 15 and q = 17, and then
xi = ( ki / 232 .
Write a program, containing a function "unif2" of type "double", which computes a random number according to the above formula, and a main program to generate 10 random numbers (by calling unif2), which are printed to standard output (the screen). So execution of the program should provide a list of 10 random numbers on the screen.
Use "iran2" in the program as name for the variable "ki" in the mathematical formula. The variable "iran1" should be declared as global variable of type "unsigned int", the variables "k", "q" and "p" should be declared as local variables of type "unsigned int". Use the "for" statement to realize the loop to generate the 10 random numbers.
In case of problems in understanding basic notions of the programming langage C: see
C tutorial
The solution of this exercise can be found here