How to make a random data generator in c++?

Recommended Answers

All 2 Replies

Of your own? How "random" do you want the output? There are plenty of texts out there that can explain some of the more common ways. Here is a great tutorial compliments of the US government and my tax dollars: http://www.phy.ornl.gov/csep/CSEP/RN/RN.html

It is one of the best treatises on the subject I have found.

If you don't want to programm your own random number generator but instead want to use something done, C++11 have a complete random number library defined in <random>. There, the standard library defines facilities for generating (pseudo-)random numbers with different distributions. I consider this library one of the most complete and advanced random number generator that exist. So, take a look to it.

Google "C++11 random number" to find tutorials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.