Computer-implemented method for computing an exposure pattern for exposing a desired pattern on a target in a charged-particle lithography apparatus, in which a particle beam (lb, 50) is directed to and illuminates a pattern definition device comprising an aperture array composed of a plurality of blanking apertures (24, 33, 43) through which said particle beam (pb) penetrates for writing said desired pattern by exposing a multitude of pixels (px) within an image area on the target, said particle beam (pb) having a distribution of current dose ( D i) for the plurality of blanking apertures of said aperture array, said method taking into account a deviation of said distribution ( D i) from a nominal current dose value (c) assumed to be constant over said plurality of blanking apertures, wherein in the pattern definition device said plurality of blanking apertures (24, 33, 43) is arranged in a predetermined arrangement defining mutual positions of the blanking apertures, each blanking aperture being selectively adjustable with regard to a dose value to be exposed through the respective blanking aperture onto a corresponding aperture image on the target during a respective exposure interval, said dose value taking a respective value selected from a discrete gray scale, wherein during a writing process of said desired pattern, a sequence of exposure intervals is made, wherein in each exposure interval the blanking apertures are imaged onto the target, thus generating a corresponding plurality of aperture images (b1, bi0, bi1), wherein the position of aperture images is kept fixed relative to the target at the position of a pixel (px) during an exposure interval, but between exposure intervals the position of aperture images is shifted over the target, thus exposing the multitude of pixels within said image area on the target, wherein the method comprises: (i) providing a map (Mp) of said distribution ( D i), correlating each aperture with a current factor, said current factor describing the current dose ( D i) of the beam at the location of the respective aperture, (ii) providing the desired pattern and calculating a nominal exposure pattern as a raster graphics (ps) defined on the multitude of pixels, said nominal exposure pattern being suitable to create a nominal dose distribution on the target realizing contour lines of the desired pattern and including for each pixel a respective nominal dose value ( y), (iii) calculating, for each pixel, a compensated dose value ( y ') by dividing the respective nominal dose value by a compensation factor ( q) corresponding to the current factor of the aperture corresponding to the respective pixel, (iv) determining, for each pixel, a discrete value by selecting a value from the discrete gray scale which approximates the compensated dose value, and (v) generating, from the nominal exposure pattern, a compensated exposure pattern suitable to expose the desired pattern by said writing process by substituting the discrete values determined in step iv for the nominal dose values, and wherein the aperture images are mutually overlapping on the target, and the aperture images have a nominal width (b) which is greater than and is a multiple of the distance ( e) between pixel positions of neighboring aperture images on the target, the method characterized in that in step iv, for a pixel where the corresponding compensated dose value falls between two values of the discrete gray scale, said compensated dose value is approximated by assigning at least two different values of the discrete gray scale to the aperture images affecting the respective pixel, such that the average of the values thus assigned reproduces the compensated dose value within a predetermined dose error width or follows a stochastic probability distribution which has an expectation value which reproduces the compensated dose value. (i) providing a map (Mp) of said distribution ( D i), correlating each aperture with a current factor, said current factor describing the current dose ( D i) of the beam at the location of the respective aperture, (ii) providing the desired pattern and calculating a nominal exposure pattern as a raster graphics (ps) defined on the multitude of pixels, said nominal exposure pattern being suitable to create a nominal dose distribution on the target realizing contour lines of the desired pattern and including for each pixel a respective nominal dose value ( y), (iii) calculating, for each pixel, a compensated dose value ( y ') by dividing the respective nominal dose value by a compensation factor ( q) corresponding to the current factor of the aperture corresponding to the respective pixel, (iv) determining, for each pixel, a discrete value by selecting a value from the discrete gray scale which approximates the compensated dose value, and (v) generating, from the nominal exposure pattern, a compensated exposure pattern suitable to expose the desired pattern by said writing process by substituting the discrete values determined in step iv for the nominal dose values, and