I agree that judges should more discretion in sentencing. The law cannot be written to anticipate every possibility. We have to be able to trust judges to interpret the circumstances of each individual case and make the best determination from the facts. Drug cases are a good example, as are other nonviolent crimes. The three strikes law is another example of how justice is sometime not done. Zero tolerance policies don't take into account individual circumstances.
Mandatory sentencing became popular in the 1980s and 1990s with the War on Drugs, when scores of politicians were elected with promises to "get tough on crime". Several states enacted "Truth in Sentencing" laws meaning there would be no parole or early release. Until very recently, possession of 5 grams of crack cocaine would get a mandatory sentence of five years in prison. 500 grams of powder cocaine would yield the same sentence.
Justice is not the same thing in every case. A judge must be able to take into account the various factors that lead to and make up criminal behavior. In fact, that is the very definition of "judge". The law cannot be applied fairly, or effectively, if judges do not have discretion to rule based on a variety of factors besides the simple verdict itself.
Judges should have more discretion in sentencing. This is because the judges are the people who are able to take all of the facts, look at them, and judge the totality of what the convicted person deserves. Legislatures and citizen initiatives do not have all of this information and so cannot make the same sorts of informed decisions that judges can.
A prime example of this is the sort of issues that have come out of the popular "three strikes" laws. Judges have called for more discretion as to whether to enforce these. This is because they have been put in the position of having to put people in jail for life for a series of petty crimes. This is the sort of "blunt instrument" sentencing guideline that makes for unjust results. If judges had more leeway, they could apply the law to individual situations and could thereby create much more just outcomes than happen under strict guidelines.