The x-distribution
In case of continuous distributions, the "x-distribution" φ(x) defined in some interval [xmin,xmax] is by definition the number of x values (for a long chain of random numbers) in the interval [x,x+dx], divided by dx and the number n of random numbers.
In practice, we divide the interval [xmin,xmax] into M subintervals of width dx, with xi being the center of the i-th interval, and we count the number of random numbers Ni which fall into the i-th interval. The x-distribution is then given as φi = Ni / (n × dx), together with the x-values xi .
In the program, we use the table phi[i] for φi , the table xmi[i] for xi , Nsim for the number n of simulated random numbers and Nsub the number M of subdivisions of the x-axis.
In case of discrete distributions (discrete values xi), the "x-distribution" φ(xi) is obtained by counting the number Ni of x values with x = xi. Instead of Nsub, we use here Nval, being the number of possible xi values. The x-distribution is then given as φi = Ni / n , together with the x-values xi .
In case of problems in understanding basic notions of the programming langage C: see
C tutorial