title: How to generate a random number without a repeat in Java
body: <p>I am using this to generate a random number inside a method and return it:</p>
  
  <pre><code>int randomValue = ThreadLocalRandom.current().nextInt(0, filteredArrayList.size());
  </code></pre>
  
  <p>How can I make sure there are not two random numbers in a row? I don't care if I get a 3, then a 5, then a 3 again. Only if I get a 3 and then a 3.</p>