random generation of lengths of, and gaps between, levels