Skip to content

Instantly share code, notes, and snippets.

@yledu
Created November 8, 2012 18:49
Show Gist options
  • Save yledu/4040720 to your computer and use it in GitHub Desktop.
Save yledu/4040720 to your computer and use it in GitHub Desktop.
function writeStuff(n)
f=open("data.txt","w")
for el in 1:n
r=randi(Int32)
println(f,r)
end
close(f)
end
N = 1000_000
tic();writeStuff(N);toc()
import random
import sys
def writeStuff(n):
random.seed()
with open('data.txt', 'w') as file:
for i in xrange(n):
r = random.getrandbits(31)
print >> file, r
file.close()
N = 1000000
writeStuff(N)
function writeStuff(n)
f=open("data.txt","w")
for el in 1:n
r="12"
println(f,r)
end
close(f)
end
N = 1000_000
tic();writeStuff(N);toc()
import sys
def writeStuff(n):
with open('data.txt', 'w') as file:
for i in xrange(n):
r = "12"
print >> file, r
N = 1000000
writeStuff(N)
@yledu
Copy link
Author

yledu commented Nov 8, 2012

ok, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment