Ex0.2: Random Numbers with Numpy
This commit is contained in:
parent
45f426d0f5
commit
119c90e36e
|
@ -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) ) )
|
|
@ -0,0 +1,4 @@
|
||||||
|
Running `time ./gen_rand.py "1e9"` gives
|
||||||
|
|
||||||
|
real 0m13.803s
|
||||||
|
user 0m8.874s
|
Reference in New Issue