Using a double for loop makes it possible to generate a random height for each building using the following function:
float rand(vec2 n)Since the loop variables (i,j in this instance) are unique for each building, I can use vec2(i,j) as the seed for the rand function, which guarantees a unique value for each call. Not sure if this is the best way, but for now it will do.
return 0.5 + 0.5 *
fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);