made class header+cpp file. Fixed crashing bug

Bug was generating because the math was off in the random number
generator. it had 1+ rand % 2 to get 0 or 1, which meant that 0 never
occured, and 2 somtimes occured, which means a non-initialized array was
being accessed. added -1 to math to make it either 0 or 1 like it should
be.....

Also obviously i created a class header file and source file for the
class functions.