Using Gen for random numbers