title: Generate random data with lat-long
body: <p>I am trying to generate random data with range of specific latitude and longitude. The code below executes with no errors and also generates output but not fully what I am expecting.</p>
  
  <p>Program:</p>
  
  <pre><code>import random
  import sys
  import math
  
  latitude = 19.99
  longitude = 73.78
  output_file = 'filename'
  
  def generate_random_data():
      with open(output_file, 'w') as output:
          hex1 = '%012X' % random.randint(0,100)
          flt = float(random.randint(0,100))
          latitude = math.acos(random.random() * 2 - 1)
          longitude = random.random() * math.pi * 2
  
          output.write('%s %.1f %.6f %.6f \n' % (hex1.lower(), flt, longitude, latitude))
  
  if __name__ == '__main__':
      generate_random_data()
  </code></pre>
  
  <p>The above code runs but gives only one row (which could be indentation problem) But this does not give me random <code>lat</code> &amp; <code>long</code> in required Geo location as mentioned above. </p>
  
  <p>Output generated:</p>
  
  <p><code>000000000020 95.0 3.929691 1.749931</code></p>
  
  <p>Output Expected:
  <code>000000000020 95.0 19.999691 73.799931</code></p>
  
  <p>And this generates only <code>one</code> row where as I am trying to have <code>million</code> rows</p>