code: def _rand_cpu_str(cpu):
      '''
      Return a random subset of cpus for the cpuset config
      '''
      cpu = int(cpu)
      avail = __salt__['status.nproc']()
      if cpu < avail:
          return '0-{0}'.format(avail)
      to_set = set()
      while len(to_set) < cpu:
          choice = random.randint(0, avail - 1)
          if choice not in to_set:
              to_set.add(six.text_type(choice))
      return ','.join(sorted(to_set)f _rand_cpu_str(cpu):
      '''
      Return a random subset of cpus for the cpuset config
      '''
      cpu = int(cpu)
      avail = __salt__['status.nproc']()
      if cpu < avail:
          return '0-{0}'.format(avail)
      to_set = set()
      while len(to_set) < cpu:
          choice = random.randint(0, avail - 1)
          if choice not in to_set:
              to_set.add(six.text_type(choice))
      return ','.join(sorted(to_set))
docs: Return a random subset of cpus for the cpuset config