how do i generate (not spawn) prefabs?

so i havent coded anything yet but im thinking of way to generate prefabs. i want to create simple blocky shapes with one size blocks. my idea was i enter random x value, spawn that many blocks on the x axis, move up the spawnpoint by 1 on the y then do that again a random amount of times. is this inefficient? i cannot find a single tutorial on how to randomly generate shapes.

if u know a tutorial on this stuff pls send me the link

for randomly generating shapes in 2d I use spriteshape. I also typed "unity tutorial randomly generate shapes: in google and there are TONS of tutorials!!! Just pick one and try it out…