> discrimination can either be legal or illegal
Right, every nonrandom decision is discrimination, but in the US private discrimination is generally legal unless it effects a protected category; because of the rational basis test, in the US, public dsicrimination is generally invalid unless it meets some bar of justification, but unless a particularly protected basis of discrimination is involved or a particularly important right impinged, the bar for validity is very low (a rational relation to a legitimate government function.)