-
-
Save cosmic-cortex/0842339be2698cddbbd19f35fa5143f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from timeit import timeit | |
from numpy.random import random as random_np | |
from random import random as random_py | |
n_runs = 10000000 | |
t_builtin = timeit(random_py, number=n_runs) | |
t_numpy = timeit(random_np, number=n_runs) | |
print(f"Built-in random:\t{t_builtin}s") | |
print(f"NumPy random: \t{t_numpy}s") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment