Implemented basic lottery functionality.

Basic lottery functionality implemented. Doesn't behave as it should
yet.

Also added crunch test program