Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>#include &lt;thread&gt; #include &lt;chrono&gt; ::: for (int i = 5; i &gt; 0; i--) { for (int j = 1000; j &gt; 0; j -= i) { cout &lt;&lt; randNumGen(); std::this_thread::sleep_for( std::chrono::milliseconds(j)); } } </code></pre> <p><a href="http://en.cppreference.com/w/cpp/thread/sleep_for" rel="nofollow">http://en.cppreference.com/w/cpp/thread/sleep_for</a></p> <p><a href="http://en.cppreference.com/w/cpp/chrono" rel="nofollow">http://en.cppreference.com/w/cpp/chrono</a></p> <p>it is probably also worth your while look at C++11 random it is more C++ way of generating random number in a cross platform way.</p> <pre><code>std::uniform_int_distribution&lt;int&gt; distribution(1, 6); //dice values std::mt19937 engine; // Mersenne twister MT19937 int random = distribution(engine); </code></pre> <p><a href="http://en.cppreference.com/w/cpp/numeric/random" rel="nofollow">http://en.cppreference.com/w/cpp/numeric/random</a></p> <pre><code>#include &lt;thread&gt; #include &lt;chrono&gt; #include &lt;random&gt; #include &lt;iostream&gt; ::: std::random_device rd; std::uniform_int_distribution&lt;int&gt; dist(1, 6); //dice values std::mt19937 mt(rd()); // Mersenne twister MT19937 for (int i = 5; i &gt; 0; i--) //i don't really get what your loops mean { for (int j = 1000; j &gt; 0; j -= i) { cout &lt;&lt; dist(mt); std::this_thread::sleep_for( std::chrono::milliseconds(j)); } } </code></pre> <p>You will need to compile with c++11 support for gcc and clang this is -std=c++0x</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload