bob gailer wrote:

> 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

Note that this is not random. E. g. the start sequence "0"*101 should have a 
likelyhood of 1/10**101 but is impossible to generate with your setup.

Peter

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

Reply via email to