How to generate random numbers in C++11

C++11 makes it easier to write simple random number generation code. This was quite a bit convoluted in C++03 as explained in this older post. With some new classes and syntactic sugar, C++11 is much easier.

Here is an example which generates 10 random int8_t and float values:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s