<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _build_skydir_dict(wcsgeom, rand_config):
 """Build a dictionary of random directions"""

        step_x = rand_config['step_x']
        step_y = rand_config['step_y']
        max_x = rand_config['max_x']
        max_y = rand_config['max_y']
        seed = rand_config['seed']
        nsims = rand_config['nsims']

        cdelt = wcsgeom.wcs.wcs.cdelt
        pixstep_x = step_x / cdelt[0]
        pixstep_y = -1. * step_y / cdelt[1]
        pixmax_x = max_x / cdelt[0]
        pixmax_y = max_y / cdelt[0]

        nstep_x = int(np.ceil(2. * pixmax_x / pixstep_x)) + 1
        nstep_y = int(np.ceil(2. * pixmax_y / pixstep_y)) + 1

        center = np.array(wcsgeom._center_pix)

        grid = np.meshgrid(np.linspace(-1 * pixmax_x, pixmax_x, nstep_x),
                           np.linspace(-1 * pixmax_y, pixmax_y, nstep_y))
        grid[0] += center[0]
        grid[1] += center[1]

        test_grid = wcsgeom.pix_to_coord(grid)
        glat_vals = test_grid[0].flat
        glon_vals = test_grid[1].flat
        conv_vals = SkyCoord(glat_vals * u.deg, glon_vals *
                             u.deg, frame=Galactic).transform_to(ICRS)

        ra_vals = conv_vals.ra.deg[seed:nsims]
        dec_vals = conv_vals.dec.deg[seed:nsims]

        o_dict = {}
        for i, (ra, dec) in enumerate(zip(ra_vals, dec_vals)):
            key = i + seed
            o_dict[key] = dict(ra=ra, dec=dec)
        return o_dict