Generating equilateral random polygons in confinement