We propose a Monte Carlo code for the simulation of the fragmentation process
of polarized quarks into pseudoscalar mesons. Such process is generated
recursively once the flavour, the energy and the spin density matrix of the
initial quark are specified, performing a cascade of splittings of the type
$q rightarrow h+q'$, where $q, q'$ indicate quarks and $h$ the hadron with
flavour content $qarq'$. Each splitting is generated using a splitting
distribution which has been calculated in a string fragmentation framework
including, for the first time, the $^3P_0$ mechanism. This mechanism involves
a "complex mass" parameter responsible for transverse spin effects, such as the
Collins effect. Results for single hadron and hadron pair analyzing power are
found to be in agreement with experimental results from SIDIS and $e^+e^-$
annihilation.