Minor modifications to random generation.