Reservoir sampling is a technique for selecting a fair random sample when you don’t know the size of the set you’re sampling from.

Source: Reservoir Sampling