Gathering random sample for tree, storing unique values while counting for histogram