Monte Carlo integration, simple example

What we are doing is to employ a random number generator to obtain numbers \( x_i \) in the interval \( [0,1] \) through a call to one of the library functions \( ran0 \), \( ran1 \), \( ran2 \) or \( ran3 \) which generate random numbers in the interval \( x\in [0,1] \). These functions will be discussed in the next section. Here we simply employ these functions in order to generate a random variable. All random number generators produce pseudo-random numbers in the interval \( [0,1] \) using the so-called uniform probability distribution \( p(x) \) defined as $$ \begin{equation*} p(x)=\frac{1}{b-a}\Theta(x-a)\Theta(b-x), \end{equation*} $$ with \( a=0 \) og \( b=1 \) and where \( \Theta \) is the standard Heaviside function or simply the step function.