Function to get distinct random values.