Randomly subsample from a vector of counts, with or without replacement.
Parameters:  counts : 1D array_like
n : int
replace : bool, optional


Returns:  subsampled : ndarray

Raises:  EfficiencyWarning

Notes
If subsampling is performed without replacement (replace=False), a copy of counts is returned if n is equal to the number of items in counts, as all items will be chosen from the original vector.
If subsampling is performed with replacement (replace=True) and n is equal to the number of items in counts, the subsampled vector that is returned may not necessarily be the same vector as counts.
Examples
Subsample 4 items (without replacement) from a vector of counts:
>>> import numpy as np
>>> from skbio.math.subsample import subsample
>>> a = np.array([4, 5, 0, 2, 1])
>>> sub = subsample(a, 4)
>>> sub.sum()
4
>>> sub.shape
(5,)
Trying to subsample an equal number of items (without replacement) results in the same vector as our input:
>>> subsample([0, 3, 0, 1], 4)
array([0, 3, 0, 1])
Subsample 5 items (with replacement):
>>> sub = subsample([1, 0, 1, 2, 2, 3, 0, 1], 5, replace=True)
>>> sub.sum()
5
>>> sub.shape
(8,)