update implementation to allow for a single argument

add conditional to account for relationship between argument and element list

add condition for calling sample on an empty array

incorporate tyler's implementation suggestions and throw errors on bad inputs