Beyond the lognormal approximation: a general simulation scheme