title: How to create same set of random numbers every time a function is executed in VB.NET
body: <p>I'm really confused by a lot of the answers on here pertaining to creating same set of random numbers between function calls.</p>
  
  <p>Some people are saying you will get non-repeating numbers if you seed the random function, other the exact opposite. Can someone please show me how this is done in VB.Net?</p>
  
  <p>Goal: </p>
  
  <p>• I want to have seed: a</p>
  
  <p>•    I call the rand function within main: rand(a)</p>
  
  <p>•    Given n number of function calls to rand,  rand(a) gives set of
     random numbers A,</p>
  
  <p>•    Run ends</p>
  
  <p>•    I run main again and I expect to get the same set of random numbers
     A</p>
  
  <p>Here's some thoughts:</p>
  
  <pre><code>Private Function Generate_Random_Number(Byval Lower as integer, Byval Upper as integer, Byval seed as integer) 
      Dim Random_Value as Integer
  
      randomize(seed)
      random_value = rand.next(lower, upper + 1)
  
      Return random value
  End Function
  
  Private Sub Main()
      Seed = 100
  
      For i = 0 to 1 'run this function for two times
          Get_Random_Numbers(Seed)
      Next i
  End Sub
  
  Private Sub Get_Random_Numbers(Seed)
      Dim x, y, w, z as integer
  
      x = Generate_Random_Number(0,1, seed)
      y = Generate_Random_Number(1,2, seed)
      w = Generate_Random_Number(2,3, seed)
      z = Generate_Random_Number(3,4, seed)
  End Sub 
  </code></pre>
  
  <p>Suppose the first function call to Get_Random_Numbers give me {x = 0, y = 1, w = 2, z = 3}, for whatever reason the next call to Get_random numbers give me {x = 1, y = 2, w = 3,  z= 4} which is completely different from the first time I called this function!</p>
  
  <p>But I'm using the same seed?</p>
  
  <p>Can someone tell me what I'm doing wrong?</p>
  
  <p>Thank you</p>