Length[Union[RandomInteger[{1, k}, n]]] where n=1000, k=1000