Correspond an object's z coordinate to a noise texture?
If the cubes are identical, you can parent a cube to a grid, displace the grid and use the grid as per vertex instancer:

To do that:

Create a grid
Add it the displacement modifier and set its direction to &quot;Z&quot;
Parent a cube to the grid
In the grid property panel, set &quot;instancing&quot; to &quot;vertices&quot;.


If you want some color variation, you can set it using the cube shader. For instance:

which is done with the object info node on a noise texture: