title: Output random hex values from within a range in python
body: <p>I am able to generate random hex values in a specific range using the code below, but I get the same random value on each line if i set my counter to more than 1. I'm guessing I need a loop, I have tried with "for x in range" but my implementation must be wrong as it overflows. I'm new to python and have searched for days but can't seem to find how to implement it correctly.</p>
  
  <pre><code>    import random
      import sys
  
      #ran = random.randrange(2**64)
      ran = random.randrange(0x8000000000000000, 0xFFFFFFFFFFFFFFFF)
      myhex = "%064x" % ran
  
      #limit string to 64 characters
      myhex = myhex[:64]
  
      counter = 0
  
      file = open('output.txt', 'w')
      sys.stdout = file
  
      for result in myhex:
      print(myhex)
      counter += 1
      if counter &gt; 10:
      break
  </code></pre>