Revision 69dfa8b1 topology.c

View differences:

topology.c
355 355
    // random from the rest
356 356
    nidset_complement(others, &others_size, candidates, candidates_size, selecteds, selecteds_size);
357 357
    nidset_shuffle(others, others_size);
358
    random_size = NEIGHBORHOOD_TARGET_SIZE ? MIN(others_size, NEIGHBORHOOD_TARGET_SIZE - selecteds_size) : others_size;
358
    random_size = NEIGHBORHOOD_TARGET_SIZE ? MIN(others_size, MAX(NEIGHBORHOOD_TARGET_SIZE - selecteds_size, 0)) : others_size;
359 359
    nidset_add_i(selecteds, &selecteds_size, max_ids, others, random_size);
360 360

  
361 361
    fprintf(stderr,"Topo modify sel:%d (from:%d) = keep: %d (of old:%d) + desired: %d (from %d of %d; target:%d) + random: %d (from %d)\n",

Also available in: Unified diff