example2: random number on cloud added. more refactoring