You can use arrays of relative coin positions.
eg an array [container_id] [coin_id] [pos]:
// coin 0 of container 0
array[0][0][0] = 0 // relative x-pos
array[0][0][1] = 0 // relative y-pos
// coin 1 of container 0
array[0][1][0] = 10 // relative x-pos
array[0][1][1] = -3 // relative y-pos
// coin 2 of container 0
array[0][2][0] = 22 // relative x-pos
array[0][2][1] = -6 // relative y-pos
// coin 3 of container 0
array[0][3][0] = 36 // relative x-pos
array[0][3][1] = -10 // relative y-pos
....
you can create different shapes for the container with the relative coin ositions.
then create the (random) container coins relative to the initial position.