Skip to content

Instantly share code, notes, and snippets.

@hlian
Created January 12, 2011 03:37
Show Gist options
  • Save hlian/775653 to your computer and use it in GitHub Desktop.
Save hlian/775653 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import random
import sys
print(1000)
def randfloat(a, b):
return random.random() * (b - a) + a
for i in xrange(int(sys.argv[1])):
x = random.randint(-1000, 1000)
y = random.randint(-1000, 1000)
z = random.randint(-1000, 1000)
vx = randfloat(1e4, 1e10)
vy = randfloat(1e4, 1e10)
vz = randfloat(1e4, 1e10)
mass = randfloat(1e20, 1e30)
print('%.4g %.4g %.4g %.4g %.4g %.4g %.4g' % (x, y, z, vx, vy, vz, mass))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment