YPLEX
Assignment 1

1. In this assignment, we will be writing Generators that produces random values on an open-ended interval between two given numbers. As a baseline, use the following ubiquitous kernel for numbers between 0.0 and 1.0:

double(rand()) / (double(RAND_MAX) + 1.0);

to write a "standard" random number generator. To get rand include <cstdlib> and don't forget to call

srand(time(0))

at the beginning of the application (which will require the inclusion of <ctime> as well).

2. Use std::generate_n (found in <algorithm>) in conjunction with the generator in (1) to fill a std::vector with a given number of random numbers between 0.0 and a given bounds.

3. Sort the vector from (2) using std::sort. (This is primarily just to exercise yet another generic algorithm and for more comparable output).

4. Calculate the average and standard deviation of all random numbers in the vector. (You get to figure out which generic algorithms to use).

5. Select two boost random number generators and use the variate_generator and the uniform_int distribution to generate random numbers between two given bounds. Perform (2) through (4) using the boost-driven generators.

6. How well does each random number generator perform and how can you tell? Would the choice of the bounds make a difference?