Using custom random generator function