Here is a simple python script to do this for you.
import rhinoscriptsyntax as rs
import random
def RunScript():
# Get the objects
instances=rs.GetObjects("Select blocks to replace", rs.filter.instance, preselect=True)
if not instances: return
block_A = rs.GetObject("Select first replacement block", rs.filter.instance)
if not block_A: return
block_B = rs.GetObject("Select second replacement block", rs.filter.instance)
if not block_B: return
# Turn off redraw to speed up the process a lot
rs.EnableRedraw(False)
# Find block names
block_A_name = rs.BlockInstanceName(block_A)
block_B_name = rs.BlockInstanceName(block_B)
# Define variables for percentage of each replacement (0.2 = 20%)
var_A = 0.2
var_B = 0.3
# Check random number against variables
for instance in instances:
rnd = random.random()
if rnd < var_A:
xform = rs.BlockInstanceXform(instance)
rs.InsertBlock2(block_A_name, xform)
rs.DeleteObject(instance)
elif rnd > 1-var_B:
xform = rs.BlockInstanceXform(instance)
rs.InsertBlock2(block_B_name, xform)
rs.DeleteObject(instance)
# Turn on redraw again
rs.EnableRedraw(True)
RunScript()
Run random into a greater then component to see if the random number was higher or lower than .5 or whatever the percentage of one option vs another is. That will create a true/false list that can be used in a pattern component that switches between the two options above.