Fixed bug in random