fixed Math.random call