@bezo In Python I used noise to create the varying random radii. By iterating through the spheres I made them touch using
sphere x position = previous sphere x + previous sphere radius + current sphere radius
this produces a chain of random touching spheres, but the wrong overall length, so I put a scaling factor in the random radii calculation (all spheres scaled by same factor). Then with the scale starting at 0, I put all the math in a 'while' loop, incrementing the scale by a very small amount in each loop until it achieved the target length -
while length < target length:
scale += 0.001
and it drops out of the loop when the length is correct.
I've found 'while' loops problematic in C4D - if the code is wrong and you get stuck in the loop, it freezes C4D needing a hard reset (losing any work since the last save). Here's a simplified version of my scene, using 10 spheres in a line.
python_spheres.c4d