Fixed faulty random number generator. Fixes #47