error checking and option for non-weighted random