MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _test_generator

Function _test_generator

tools/python-3.11.9-amd64/Lib/random.py:860–874  ·  view source on GitHub ↗
(n, func, args)

Source from the content-addressed store, hash-verified

858## ----------------- test program -----------------------
859
860def _test_generator(n, func, args):
861 from statistics import stdev, fmean as mean
862 from time import perf_counter
863
864 t0 = perf_counter()
865 data = [func(*args) for i in _repeat(None, n)]
866 t1 = perf_counter()
867
868 xbar = mean(data)
869 sigma = stdev(data, xbar)
870 low = min(data)
871 high = max(data)
872
873 print(f'{t1 - t0:.3f} sec, {n} times {func.__name__}')
874 print('avg %g, stddev %g, min %g, max %g\n' % (xbar, sigma, low, high))
875
876
877def _test(N=2000):

Callers 1

_testFunction · 0.85

Calls 5

meanFunction · 0.90
stdevFunction · 0.90
minFunction · 0.85
maxFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected