default_random_engine ... time is not an int value? |
yes, throughout
uniform_int_distribution is also its own class or type |
notice it is a class template, hence the instantiation with type parameter unsigned int in your code the type parameter could be any of short, int, long, long long, unsigned short, unsigned int, unsigned long, or unsigned long long :
http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution
So by writing uniform_int_distribution<unsigned int> range(1, 6); I have created an object of uniform_int_distribution called range |
yes which is, surprisingly enough, an uniform int distribution uniformly distributed on the closed interval [1, 6]
range(numGenerator)what is going on |
here you have an overload of operator () defined for the range object that takes an argument numGenerator aka the generator object which, in turn,
supplies uniformly-distributed random integers through its operator() member function |
(corresponding to your
(time(NULL))
)
The uniform_int_distribution object transforms the values obtained this way so that successive calls to this member function with the same arguments produce values that follow a uniform distribution within the appropriate range |
http://www.cplusplus.com/reference/random/uniform_int_distribution/
So then the final question remains, what sort of random numbers are generated by the default_random_engine itself that are then scaled by the distribution object to give 'nice' random numbers b/w 1 and 6? Here, I'm afraid there's a bit of hand-waving on the reference websites as far as I can see, for e.g cplusplus says about std::default_random_engine:
It is the library implementation's selection of a generator that provides at least acceptable engine behavior for relatively casual, inexpert, and/or lightweight use |
and cppreference does not say much more:
http://en.cppreference.com/w/cpp/numeric/random
but if you are still interested you can try and dig up the actual C++ standard docs and see what else they have to say on this