Hey guys!
I'm looking for an algorithm to randomly distribute sprites on the line.
Let's say the line length is 100 px, and each sprite is 10 px wide.
Number of sprites can be different, from 1 to 8.
Sprites can touch, but not overlap.
It's not a problem to distribute 4 sprites, but with 5 or more it's possible to run out of free space if I just place them randomly.
Seems like an easy task, but I can't figure it out.