The way you describe your requirement seems to suggest that using a normal distribution (aka Gaussian distribution) may be the way to go. It has two parameters: Mean and standard deviation. If you set the standard deviation very low, you get random values that are probably quite close to the mean. If you set it to a large value, you get them distributed more widely.
In C++11 a normal distribution is available from the standard library. If C++11 is not an option for you, the Boost library has it, too.
Here is some example code:
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <random>
#include <cmath>
#include <iomanip>
int main()
{
std::random_device rd;
std::mt19937 gen(rd());
std::cout << std::fixed << std::setprecision(3);
/* Mean 5, standard deviation very low (0.002): */
std::normal_distribution<> d1(5,0.002);
for (int i = 0 ; i < 20 ; ++i)
std::cout << std::setw(7) << d1(gen) << " ";
std::cout << std::endl;
/* Mean 5, standard deviation relatively high (2.0): */
std::normal_distribution<> d2(5,2);
for (int i = 0 ; i < 20 ; ++i)
std::cout << std::setw(7) << d2(gen) << " ";
std::cout << std::endl;
return 0;
}
Here is the output:
4.998 5.003 5.001 5.002 5.001 5.001 4.998 5.000 4.999 5.001 5.000 5.003 4.999 5.000 5.001 4.998 5.000 4.999 4.996 5.001
2.781 3.795 5.669 -0.109 7.831 3.302 3.823 4.439 4.672 4.461 6.626 5.139 6.882 5.406 6.526 5.831 6.759 2.627 3.918 4.617
As you can see, in the first row all numbers are quite close to 5 (i.e., to use your wording, "randomness" is low), while in the second row the numbers are spread much more widely.
(EDIT: Of course, the randomness of these numbers isn't really affected. It's just that the standard deviation parameter makes the values more likely to emerge in a smaller (stddev low) or wider (stddev high) range of numbers.)