Optimal choice problems with a random number of objects