Replaced old rand() with mt_rand(). Closes #163