random generation fixes