  Context: There is increasing need for good algorithms for modeling the
aggregation and fragmentation of solid particles (dust grains, dust aggregates,
boulders) in various astrophysical settings, including protoplanetary disks,
planetary- and sub-stellar atmospheres and dense molecular cloud cores. Here we
describe a new algorithm that combines advantages of various standard methods
into one.
  Aims: The aim is to develop a method that 1) can solve for aggregation and
fragmentation, 2) can easily include the effect and evolution of grain
properties such as compactness, composition, etc., and 3) can be built as a
coagulation/fragmentation module into a hydrodynamics simulations.
  Methods: We develop a Monte-Carlo method in which we follow the 'life' of a
limited number of representative particles. Each of these particles is
associated with a certain fraction of the total dust mass and thereby
represents a large number of true particles which all are assumed to have the
same properties as their representative particle. Under the assumption that the
total number of true particles vastly exceeds the number of representative
particles, the chance of a representative particle colliding with another
representative particle is negligibly small, and we therefore ignore this
possibility. This now makes it possible to employ a statistical approach to the
evolution of the representative particles.
  Results: The method reproduces the known analytic solutions of simplified
coagulation kernels, and compares well to numerical results for Brownian motion
using other methods. For reasonably well-behaved kernels it produces good
results even for moderate number of swarms.
