randrange replaced to point to a single function gen_randrange*

* named differently in the final commit

Also some renaming and refactoring (Thanks PyCharm)