title: Reducing random uniform int distribution on each pass
body: <p>Working on a class that has a block size of 256 elements. And each time my add function is called before I store anything; I want to generate a uniform random int in the range of [0,255]. What I would like to do is before this function finishes to keep track of the previous values used so that the next time through the function the uniform random int distribution will automatically skip those values instead of having to check to see if something is already contained there. </p>
  
  <pre><code>template&lt;class T&gt;
  class SomeClass {
       struct Node {
           unsigned idx;
           std::shared_ptr&lt;T&gt; pT;
  
           Node() : idx(-1), pT(nullptr) {}
           Node( unsigned idx_, std::shared_ptr&lt;T&gt;&amp; pT_ ) : idx(idx_), pT(pT_) {}
      }; // Node
  
  private:
       Node m_storage[256];
       static unsigned m_elementCount;
       std::set&lt;unsigned&gt; m_indexesUsed; 
  public:
      SomeClass(){}
      ~SomeClass(){}
  
      void add( T&amp; obj );
  }; // SomeClass
  
  template&lt;class T&gt;
  unsigned SomeClass&lt;T&gt;::m_elementCount = 0;    
  
  template&lt;class T&gt;
  void SomeClass&lt;T&gt;::add( T&amp; obj ) {
  
      if ( m_elementCount == 256 ) {
          return; // My Code Base Is Bigger - If This Is Full This Array gets pushed into a vector, 
          // and all values get reset to default and we start over.
      }
      Node n;
  
      // Generate Uniform Random In Distribution In The Range of [0,255]
      // Excluding the Values from m_listIndexesUsed.
      n.idx =  std::uniform_random_int_distribution from [0,255] excluding previous selected numbers
      n.pT = std::make_shared&lt;T&gt;( obj );
      m_storage[n.idx] = n;
      m_indexesUsed.insert( n.idx );
      m_elementCount++;
  }
  </code></pre>
  
  <p>Can determining a value between a specified range my case [0,255] be generated where on each consecutive call determine another random value that wasn't already previously chosen with uniform random int distribution? If so, how would this be done?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>After considering some of the comments below, they have brought up a good point. What is really needed in my case is a set of 256 unique key values ranging from 0 - 255 and they need to be randomly shuffled or scrambled. I will give it some thought as how to try to accomplish this, but if any are willing to get a nice example of one, that is acceptable to. I don't mind putting in the work, but sometimes when I get to a point that I can't seem to get past and I begin to spend too much time on it, I just want to get past that point so I can move on. </p>