5,337
edits
(→Path) |
|||
Line 332: | Line 332: | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
std::sort(std::execution::par_unseq, sorted.begin(), sorted.end()); | std::sort(std::execution::par_unseq, sorted.begin(), sorted.end()); | ||
</syntaxhighlight> | |||
===Random=== | |||
<code>#include <random></code><br> | |||
[https://en.cppreference.com/w/cpp/header/random cppreference.com]<br> | |||
<syntaxhighlight lang="cpp"> | |||
std::random_device rd; //Will be used to obtain a seed for the random number engine | |||
std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd() | |||
std::uniform_int_distribution<> dis(1, 6); | |||
for (int n=0; n<10; ++n) | |||
//Use dis to transform the random unsigned int generated by gen into an int in [1, 6] | |||
std::cout << dis(gen) << ' '; | |||
std::cout << '\n'; | |||
</syntaxhighlight> | </syntaxhighlight> | ||