Refactorig randomise and adding tests
Fixed minor review comments
Merge pull request #9 from mrda/randomness-refactoring

Refactorig randomise and adding tests