Remove duplication between InRange and primitive generators