Check this out:

import random, time
s = time.time()
cycles = 1000
d = "0123456789"*100
f = open("numbers.txt", "w")
for i in xrange(n):
  l = []
  l.extend(random.sample(d, 1000))
  f.write(''.join(l))
f.close()
print time.time() - s

1 million in ~1.25 seconds

Therefore 1 billion in ~21 minutes. 3 ghz processor 2 g ram.

Changing length up or down seems to increase time.

--
Bob Gailer
919-636-4239
Chapel Hill NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to