C++11C++14C++17Learn C++Numerics

Introduction to Random Number Generation in Modern C++

Every implementation of the C++ Standard Library like one included to Embarcadero RAD Studio C++ compilers provides two ways for (pseudo-)random numbers generation: old-fashioned facilities from and modern facilities provided by . Facilities from There are two very simple functions provided by the C random library: std::srand() and std::rand(). The former seeds the pseudo-random number…
Read more
C++17Generic ProgrammingLearn C++

Helpers for Generic C++ Code Accessing Container Properties

In addition to Helpers for Generic C++ Code Iterating Over Sequences the C++17 Standard Library provides the following helpers for writing generic code: #include // new helpers of C++17 are defined here template void foo(Container& c) { // Generic way to obtain: auto data = std::data(c); // - data; auto empty = std::empty(c); // - flag of emptiness; auto size = std::size(c); // -…
Read more