How to realize the uniformly distributed value of C++
This article introduces the knowledge of "how to achieve C++ uniformly distributed values". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
# include
# include
Whole Lord ()
{
Random device read; / / will be used to obtain the seeds of the random number engine
Mt19937 generates (read ()); / / to read () seeded standard Mason cyclone engine
Standard:: uniform real distribution is not (1, 2)
For (whole n = 0; n < 10; + + n) {
/ / the random positive integral generated by non-transformation is transformed into the double essence in [1,2).
Output