Message383532
The library function random.uniform takes about twice as long as a manual inline implementation (Python 3.9.1).
>>> import timeit
>>> timeit.timeit('3 + (8 - 3) * random.random()', 'import random')
0.1540887290000228
>>> timeit.timeit('a + (b - a) * random.random()', 'import random\na = 3\nb = 8')
0.17950458899986188
>>> timeit.timeit('random.uniform(3, 8)', 'import random') # does the call/return really add that much overhead?
0.31145418699999894 |
|
Date |
User |
Action |
Args |
2020-12-21 15:25:39 | Scott Norton | set | recipients:
+ Scott Norton |
2020-12-21 15:25:39 | Scott Norton | set | messageid: <1608564339.76.0.67705848453.issue42706@roundup.psfhosted.org> |
2020-12-21 15:25:39 | Scott Norton | link | issue42706 messages |
2020-12-21 15:25:39 | Scott Norton | create | |
|