def _rand_cpu_str(cpu):
 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(str(choice))
 return ','.join(sorted(to_set))

def _rand_cpu_str ( cpu ) : 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 ( str ( choice ) ) return ',' . join ( sorted ( to_set ) )
return a random subset of cpus for the cpuset config .