I have many objects with the same name. I can search for these in the Collection window. I would like to select a random subset of these.

I can see that Blender 2.8 has a Select -> Select Random option, but this includes all visible objects.

  • 1
    $\begingroup$ How about hiding all other objects temporarily? $\endgroup$
    – Leander
    Jun 21, 2019 at 7:00
  • $\begingroup$ @Leander That would be an option. Is there a way to do this without 'un-hiding' any already hidden objects when making the original objects visible again? $\endgroup$
    – rhughes
    Jun 21, 2019 at 7:03

1 Answer 1


One option would be to use select random and then run a script that deselects anything that doesn't match the name that you specify.

import bpy

for o in bpy.context.visible_objects:
    if 'gizmo' not in o.name.lower():

Another way could be to make a list of objects matching the name criteria and then getting a random choice from that list and selecting them.

import bpy
from random import choices


objlist = [o for o in bpy.context.visible_objects
            if 'gizmo' in o.name.lower()]

rand_list = choices(objlist, k=int(len(objlist) * .75))

for o in rand_list:

In this example, I set the k parameter to be 75% of the object list. You could also specify an exact number of objects that you want selected.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .