Ex0.2: Random Numbers with Numpy
This commit is contained in:
parent
45f426d0f5
commit
119c90e36e
2 changed files with 15 additions and 0 deletions
11
ex0.2/gen_rand.py
Executable file
11
ex0.2/gen_rand.py
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import sys
|
||||||
|
|
||||||
|
N = 1e6
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
N = float(sys.argv[1])
|
||||||
|
|
||||||
|
print( np.random.rand( int(N) ) )
|
4
ex0.2/results.txt
Normal file
4
ex0.2/results.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Running `time ./gen_rand.py "1e9"` gives
|
||||||
|
|
||||||
|
real 0m13.803s
|
||||||
|
user 0m8.874s
|
Reference in a new issue