Fixed random number bug