Skip to content

A fast cython replacement for the standard library’s random module.

License

Notifications You must be signed in to change notification settings

Noctem/cyrandom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cyrandom

A fast Cython package for random number generation.

Performance Comparison

All times are seconds to complete one million iterations (except for shuffle which is 100,000 iterations). The benchmarking script can be found here.

function stdlib cyrandom speedup
randrange 1.7863 0.12805 13.95x
randint 2.1198 0.12258 17.29x
choice 1.0969 0.05815 18.86x
shuffle 44.806 0.98338 45.56x
choices 3.3938 0.49235 6.89x
uniform 0.28339 0.08624 3.29x
triangular 0.72341 0.10253 7.06x

Be aware that (for performance reasons) there is less input validation in some of these functions than in the standard library, so ensure that your arguments are valid.