CSE 202: Computer Science II, Winter 2018
Lab 5

Do not use any components from <random> for this lab. Use std::srand and std::rand for both exercises.

  1. Create a program that generates a specified number of random integers within a specified range. The number of integers to generate will be specified in the argv[1], the minimum value in the range will be specified in argv[2], and the maximum value in range will be specified in argv[3].

    If you're program was named random_integers, then the command:

    ./random_integers 3 -100 100

    Would produce something like the following:

    59 -19 16

    Solution

  2. Create a program that generates a specified number of random floating-point values within a specified range, the numbers will be values that can be represented by the type double. The number of floating-point values to generate will be specified in argv[1], the minimum value in the range will be specified in argv[2], and the maximum value in the range will be specified in argv[3].

    Solution