Object handles and randomization

Randomization doesn’t create new objects, so you can’t get what you want. The only way (I know of) to do this in SystemVerilog is to split your randomization into two steps. You first randomize an array containing the kinds of objects to be created. Afterwards you create the objects. Finally, you randomize the newly created objects.

1 Like