Minor changes

* Prevent extra rand() calls during for() loops
* Added missing static declaration to a couple of methods