6 changed files with 47 additions and 21 deletions
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3 |
||||
|
||||
import numpy as np |
||||
import sys |
||||
|
||||
N = 1e6 |
||||
|
||||
if len(sys.argv) > 1: |
||||
N = float(sys.argv[1]) |
||||
|
||||
for _ in range(int(N)): |
||||
print( np.random.rand(1) ) |
@ -1,4 +1,10 @@
|
||||
Running `time ./gen_rand.py "1e9"` gives |
||||
Running `time ./gen_rand.py "1e6"` gives |
||||
|
||||
real 0m13.803s |
||||
user 0m8.874s |
||||
real 0m0.237s |
||||
user 0m0.160s |
||||
|
||||
Contrast this to the following: |
||||
Running `time ./gen_rand_explicit.py "1e6"` gives |
||||
|
||||
real 2m11.564s |
||||
user 2m1.950s |
||||
|
Reference in new issue