title: Eliminate the "conversion to std::vector<int>::size_type to int" warning
body: <p>I want to eliminate warnings in my code and I am looking for an answer regarding those two:</p>
  
  <pre><code>1.   warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for( auto i = 0; i &lt; w.size(); i++ ) {
  </code></pre>
  
  <p>and</p>
  
  <pre><code>2. warning: conversion to ‘std::vector&lt;int&gt;::size_type {aka long unsigned int}’ from ‘int’ may change the sign of the result [-Wsign-conversion]
           for ( int count = 0; count &lt; w[i]; count++ )
  </code></pre>
  
  <p>The source code is below. A vector of ints is returned with some random numbers.</p>
  
  <blockquote>
  <pre><code> for( auto i = 0; i &lt; w.size(); i++ ) {
  </code></pre>
  </blockquote>
  
  <pre><code>     std::vector&lt;int&gt; random(std::vector&lt;int&gt;&amp; w){
  
  
          std::vector&lt;int&gt; v;
          v.clear();
  
          std::random_device device;
          std::mt19937 generator(device());
  
          for( auto i = 0; i &lt; w.size(); i++ ) {
  
              for ( int count = 0; count &lt; w[i]; count++ )
                  v.push_back(i);
          }
  
          std::shuffle(v.begin(), v.end(), generator);
  
          return v;
      }
  </code></pre>
  
  <p>Optimal solution? </p>