onepasswordpy icon indicating copy to clipboard operation
onepasswordpy copied to clipboard

Remove different random functions

Open RazerM opened this issue 8 years ago • 0 comments

I know that the different functions are not currently used, but the recommendation I see (which links to this page) is simply to use os.urandom.

I also ran a benchmark and it seems like there is no reason for the barely_ or not_ functions to exist. This is on OS X, which doesn't distinguish between urandom and random, so the poor performance in really_ is wasted.

 benchmark 'Random': 4 tests, min 5 rounds (of min 25.00us), 1.00s max time, timer: time.time 
Name (time in us)             Min         Max       Mean     StdDev  Rounds  Iterations
---------------------------------------------------------------------------------------
test_not_random          123.9777    612.0205   166.2388    52.2006    3831           1
test_barely_random       600.8148   9958.0288   908.9467   510.4290    1447           1
test_sort_of_random       32.9018   1744.0319    48.5657    30.0384   12193           2
test_really_random      4308.9390  12615.9191  5938.7964  1233.9394     153           1
---------------------------------------------------------------------------------------

RazerM avatar Aug 16 '15 19:08 RazerM