Refactoring and optimization

* Marks inline on getRandom and getRandomBy.
* Adds getRandomBy2 function.
* Reformatting.
Update README.