I used the Grid node to generate a 2D lattice, adjusted the lattice height and cube height based on random integer numbers, and then used the Instance on Points node to generate a cube array. But how to make adjacent cubes have different heights?
In order to solve the problem of avoiding duplication of integer random numbers, I built a simplified proof-of-principle model. I generate a 1D array of points, generate a set of random numbers and store them as an attribute named h. Then compare whether the h value of each point is the same as the previous point. If they are the same, change the h value of this point with module and plus one. Finally, adjust the height of each point according to h. The upper part of the figure below is the original point array, and the lower part is the adjusted point array, where the height represents the value of h. It can be found that the height of the points in the red circle are adjusted because they have the same height as the previous point. The height of the points in the blue circle have not been adjusted, because the "Sample Index" node cannot obtain the updated value of h, resulting in duplicate h still existing. So, how can I get the updated h value?