STL:RAND() AND VISUAL STUDIO 2017

The stl::rand() function in C++ 2017 has now been upgraded. Now the function returns a genuine random number. The function calls the CPU instruction RDRAND if it is available. RDRAND is available with Ivy Bride and subsequent Intel processors. RDRAND is available with AMD Ryzen and subsequent processors.

Generally the old approach is to called stl::srand(0) at the start of the program and then call stl:rand() as needed. Now with C++ calls, there is no real need to call std::srand() anymore as the random numbers are now assured. Microsoft was slow to improvement the change as the Mersenne Twister is comparatively fast and adequate for many applications.

New Deep Learning Algorithm Solves Rubik's Cube

std::rand and RDRAND are part of the C++11 standard but Microsoft did not adopt it until Visual Studio 2017 was released.

An astrophysical Monte Carlo simulator examined the time to generate 107 64-bit random numbers using RDRAND on a quad-core Intel i7-3740QM processor. They found that a C implementation of RDRAND ran about 2x slower than the default random number generator in C, and about 20x slower than the Mersenne Twister.

A rubix cube puzzle is a good example of needing a random number. By randomly rotating faces by a large turns makes the cube more challenging to figure out.

Many other puzzles and games can all benefit from the improved randomness of Visual Studio 2017.

A more common need is with a browser and JavaScript which calls for a random number for some function. Now browsers can provide JavaScript for games and rendering requirements.