6 of 7 deleted 3 characters in body

C (gcc), 131 116 90 89 bytes


Try it online!

Update: Fixed a bug in the original. Fused in the helper function, reducing an additional 15 bytes.

Update 2: -25 bytes thanks to ErikF.


        printf("%d\n"+!a*2, // No clue how this works anymore, but it'll advance the pointer 
                            // to the string constant when a number shouldn't be printed.
        a=--A? // Is bottom layer?
        (l>59|A<3&l>44)*rand()%-~v // Random integer to print in [0, v]
        :v); // If bottom layer, return remaining volume