Is it the judge or jury? What about state laws that say stuff like "a minimum of three years in prison" type of thing?
Criminal Defense Attorney
The jury, after hearing the evidence at trial, determines whether or not the person is guilty. It is the judge that determines the sentence. In a misdemeanor matter the maximum sentence is generally six months, or sometimes a year. There are also certain offenses that carry specified minimums.
In felony matters the Penal Code (or Health & Safety Code, or Vehicle Code, etc.) will provide a three tier choice for the judge to choose from (often 16 months, two years, or three years for most offenses), but again some offenses may provide for a minimum sentence. The judge's choice of which sentence level to choose will be aided by the probation report and recommendation, as well as input from the District Attorney and the defense attorney.
Hope this helps.
Although I am an experienced CA criminal defense and appeals attorney, I can not 'guarantee' that my answer is entirely accurate, since I have not reviewed all of the factual circumstances of the case, nor have I discussed those circumstances fully with the questioner. The fact that I have answered this question does not establish an attorney client relationship between the questioner and my self or my office.