PPT Slide
1. Remind yourself of the algorithm to pick a random number
from a given distribution, I.e.
- pich a random number, x, in the required range.
- pick another number, Ptest, in the range 0 ? Max(P)
- if Ptest < P(x) then keep the x value generated
- otherwise repeat the loop until the test is satisfied
2. Write a class which has the following public methods:
float uniform( ) // uniform distribution
float gauss( ) // gaussian distribution
float scatter( ) // compton scattering angular distribution
3. It should also have a constructor which takes the incident photon energy and electron mass as arguments.
[You are going to need these in the Monte Carlo generator we write in the second part of the course]