How do you randomize only one axis for multiple objects

I made a scene with bottles in a row, and I need to randomize their positions along the x-axis, but keep the y and z the same for all the bottles. I have them under the same semantic class and that’s how I’m calling them in my code right now. (3.6 KB)

Hello @jonathan.meitzler! I’ve shared this post with the dev team. I’ll post back as soon as I have more to share!

Hello @jonathan.meitzler, your line rep.modify.pose(position=rep.distribution.uniform((-378.07115, 0, 0), (-371.39725, 0, 0))) looks correct to randomize only the x-axis. What is the behaviour you’re seeing?

Here’s a simplified version of your script that appears to work as intended:

import omni.replicator.core as rep

with rep.new_layer():
    camera =, 3, 27), rotation=(-10, 0, 0))
    render_product = rep.create.render_product(camera, (1920, 1200))

    def shuffle():
        rep.create.cylinder(count=20, semantics=[("class", "BlueEnergy")], scale=0.01)

        with rep.get.prims(semantics=[('class', 'BlueEnergy')]):
            rep.modify.pose(position=rep.distribution.uniform((-378.07115, 0, 0), (-371.39725, 0, 0)))

    with rep.trigger.on_frame(num_frames=5):

    writer = rep.WriterRegistry.get("BasicWriter")

Ah let me clarify. There are multiple bottles under the same semantic on an incline, meaning they have different y and z axis positions. The method shown above will simply lock the bottles to the same y-z position, despite me wanting it unchanged. I’m wondering if I can specify only the x-axis in replicator. Maybe use rep.distribution.attribute or some other method if possible?
Here’s what the bottles look like for reference.

Basically with the premade scene I have, I want to keep the bottles’ y and z coordinates unchanged when I randomize the x axis. And there are multiple under the same semantic, do I just have to make a function for each bottle? Because I’m worried about how much Replicator will have to load then